I'm working on a project for school. And the deadline is tomorrow.
I want to change the body tag and add a background image on the products page when url is:
index.php?category=nieuwBinnen&product=Belair+X ch
How can I simply achieve this. I tried the if isset method but ended without success.
You can see the website on: http://alisgfx.com/lomo/
I appreciate any help.
Ali
index.php
# geef de HTML code voor het openen van de pagina weer
htmlOpenen('Titel van de website');
# toon de header
toonHeader();
include 'menu.php';
?>
<?php
if (isset($_GET['category']) && isset($_GET['product']) && isset($$_GET['category'])){ //display product if provided
$category = $$_GET['category'];
$product = $_GET['product'];
$error_msg = 1; //sets a basic error catcher in case product does not exist
foreach ($category as $item) {
if ($item['naam'] == $product) {
echo '
<section>
<article class="product">
<h2 class="item_name">'.$item['naam'].'</h2>
<div id="image">'.$item['foto'].'</div>
<p>'.$item['video'].'</p>
<p>
'.$item['fotos'].'
</p>
</article>
';
echo '
<article class="product simpleCart_shelfItem">
<div id="slider3">
<ul class="pager">
<li>Info</li>
<li>Reviews</li>
<li>Extra\'s</li>
</ul>
<div class="viewport">
<ul class="overview">
<li class="page"><p> '.$item['info'].' <hr />'.$item['prijs'].'Beschikbaarheid: '.$item['beschik'].' <br /><br />Aantal: <input type="text" value="1" class="item_Quantity"></p></li>
<li class="page"><p>'.$item['reviews'].'</p></li>
<li class="page"><p>'.$item['extras'].'</p></li>
</ul>
</div>
</div>
<h2 class="item_name hide"> '.$item['naam'].' </h2>
<p class="hide">'.$item['thumb'].'</p>
<a class="item_add" href="javascript:;"> Plaats product <br />in je winkelmandje </a>
</article>
';
echo '
<article class="product box-shadow">
<p>Met deze camera<br /> kun je zulke foto\'s<br /> maken</p>
<div id="slider4">
<a class="buttons prev" href="#">left</a>
<div class="viewport">
<ul class="overview">
'.$item['upload'].'
</ul>
</div>
<a class="buttons next" href="#">right</a>
</div>
<!-- <form action="" method="post">
<input type="file" name="bestand"><br>
<input type="submit" name="submit" value="Upload foto">
</form> -->
<a class="upload" href="upload">Upload je<br /> eigen foto\'s</a>
</article>
<article class="product">
<p>filmrolletje</p>
</article>
</section>
';
// echo $item['prijs']."<br/>";
// echo $item['product']."<br/>";
// echo $item['info']."<br/>";
$error_msg = 0;
}
}
if ($error_msg){ //basic error message in case product does not exist
echo 'The selected product no longer exists';
}
}
else{ //displays all product if specific product not given
?>
<!-- producten carousel -->
<section class="carousel">
<div class="banner"><img src="img/nieuw.jpg"></div>
<div id="slider1">
<a class="buttons prev" href="#">left</a>
<div class="viewport">
<ul class="overview">
<?php
foreach($nieuwBinnen as $new) {
echo '
<li>
<a href="index.php?category=nieuwBinnen&product='.urlencode($new['naam']).'">
<p>'.$new['product'].'</p>
<h2>'.$new['naam'].'</h2>
</a>
</li>
';
}
?>
</ul>
</div>
<a class="buttons next" href="#">right</a>
</div>
</section>
<!-- producten carousel -->
<section class="carousel">
<div class="banner"><img src="img/best.jpg"></div>
<div id="slider1">
<a class="buttons prev" href="#">left</a>
<div class="viewport">
<ul class="overview">
<?php
foreach($bestSellers as $best) {
echo '
<li>
<a href="index.php?category=bestSellers&product='.urlencode($best['naam']).'">
<p>'.$best['product'].'</p>
<h2>'.$best['naam'].'</h2>
</a>
</li>
';
}
?>
</ul>
</div>
<a class="buttons next" href="#">right</a>
</div>
</section>
<?php
}
include 'footer.php';
?>
inc.template.inc.php
<?php
# Public: Echo de HTML code voor het openen van de pagina
#
# $titel - Een tekst die tussen de <title> en </title> tags wordt geplaatst
#
# Examples:
#
# htmlOpenen('pagina titel');
# # => geeft onderstaande html weer
function htmlOpenen($titel){
# Geef de HTML openen code weer
echo '<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Lomography</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/jquery-ui.css">
<link rel="stylesheet" href="./fancybox/source/jquery.fancybox.css">
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please upgrade your browser or activate Google Chrome Frame to improve your experience.</p>
<![endif]-->
<section id="container" class="clearfix">
';
}
function htmlOpenenCart($titel){
# Geef de HTML openen code weer
echo '<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Lomography</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/jquery-ui-cart.css">
<link rel="stylesheet" href="./fancybox/source/jquery.fancybox.css">
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please upgrade your browser or activate Google Chrome Frame to improve your experience.</p>
<![endif]-->
<section id="container" class="clearfix">
';
}
function toonHeader() {
echo '
<header>
<a id="logo" href="index.php"><img src="img/logo.png" alt="Lomography Shop"></a>
<nav id="mainNavigation">
<ul>
<li>inloggen</li>
<li>registreren</li>
<li>over ons</li>
</ul>
</nav>
<div class="cartInfo"><span class="simpleCart_quantity"></span> items</div>
<div id="cartPopover">
<div id="triangle">▲</div>
<div class="simpleCart_items"></div>
<div id="cartData" class="clearfix">
<div class="left"><strong>Items: </strong><span class="simpleCart_quantity"></span></div>
<div class="right"><strong>Total: </strong><span class="simpleCart_total"></span></div>
</div>
<div id="popoverButtons" class="clearfix">
View
<!-- Checkout -->
</div>
</div><!--End #cartPopover-->
<div id="zoeken">
<form method="get" action="/search" id="search">
<input name="q" type="text" size="40" placeholder="Search..." />
</form>
</div>
</header>
';
}
?>
You could set it dynamically by using JavaScript / JQuery.
Could try something like:
$targetpage = $_SERVER['SERVER_NAME'].'/index.php?category=nieuwBinnen&product=Belair+X'
if (!$targetpage) {
echo background 1;
}else{
echo background 2;
}
$ class='no-bgimage'; if (isset($_GET['product']) {
$class='bgimage';
}
then in your body
<body class="<?php echo $class ?>">
then in you css
.bgimage {
background-image: url('page/to/your/image');
}
Related
I created a header.php and footer.php to lessen code repetition. Now the problem i am having is that when i go in Inspect element I see that the head tag which includes the meta tags etc.. are being displayed twice.
I am using the include function in php to display the header.php and footer.php
How can I prevent it from being displayed more than once?
This is my Header.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<title>El Tabata</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="responsive.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<header class="nav-down">
<nav class="container navbar">
<div class="hamburger">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
<div class="logo">
<h1 style="color: white">El Tabata</h1>
</div>
<div class="nav-ul nav-center ">
<ul >
<li style="--animation-order: 1;">Home</li>
<li style="--animation-order: 2;">About</li>
<li style="--animation-order: 3;">People</li>
<li style="--animation-order: 4;">Menu</li>
<li style="--animation-order: 5;">Contact</li>
<li style="--animation-order: 6;">Reservations</li>
</ul>
</div>
<div class="icon">
<img src="heart.svg" alt="favorites">
</div>
</nav>
</header>
This is my Footer.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<title>El Tabata</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="responsive.css">
<script src="https://kit.fontawesome.com/b3c12f2bf7.js" crossorigin="anonymous"></script>
</head>
<body>
<footer>
<div class=" container footer-dist">
<div class="footer-left">
<img src="./assets/mexican-mascot.png" alt="">
</div>
<div class="footer-center">
<h3>El Tabata</h3>
<p class="footer-links">
Home
|
About
|
People
|
Menu
|
Contact
|
Reservations
</p>
<p class="footer-names">© 2021 | Anthony Mifsud | Leon Zammit | Luke Portanier | CIS1054-SEM2-A-2021</p>
</div>
<div class="footer-right">
<img src="./assets/mexican-mascot.png" alt="">
</div>
<div>
</footer>
this behavior is normal, you have declared two different web pages, one in the header and one in the footer.
The browser removes the second doctype from the response to respect the W3C standards.
You can create a template.php page which contains the html structure of an HTML document (Doctype and meta tags) and include the header and footer files limited to the content of your body.
index.php or template.php
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Titre de la page</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<your meta balise>
</head>
<body>
<?php
include('header.php')
inlcude('footer.php')
?>
</body>
</html>
header.php
<header class="nav-down">
<nav class="container navbar">
<div class="hamburger">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
<div class="logo">
<h1 style="color: white">El Tabata</h1>
</div>
<div class="nav-ul nav-center ">
<ul >
<li style="--animation-order: 1;">Home</li>
<li style="--animation-order: 2;">About</li>
<li style="--animation-order: 3;">People</li>
<li style="--animation-order: 4;">Menu</li>
<li style="--animation-order: 5;">Contact</li>
<li style="--animation-order: 6;">Reservations</li>
</ul>
</div>
<div class="icon">
<img src="heart.svg" alt="favorites">
</div>
</nav>
</header>
footer.php
<footer>
<div class=" container footer-dist">
<div class="footer-left">
<img src="./assets/mexican-mascot.png" alt="">
</div>
<div class="footer-center">
<h3>El Tabata</h3>
<p class="footer-links">
Home
|
About
|
People
|
Menu
|
Contact
|
Reservations
</p>
<p class="footer-names">© 2021 | Anthony Mifsud | Leon Zammit | Luke Portanier | CIS1054-SEM2-A-2021</p>
</div>
<div class="footer-right">
<img src="./assets/mexican-mascot.png" alt="">
</div>
<div>
</footer>
Hope it was usefull to you
i'm having trouble with my code, i want it to send a user their username via email when they have forgotten it.
What it does:
Retrieves user information from database
Send HTML Email to User's email
What it doesn't do:
Display the user's login username when sent to the email.
The PHP code is below for the page "forgot-username.php"
<?php
require_once('../../Connections/localhost.php');
require('../../PHPMailer/PHPMailerAutoload.php');
if(isset($_POST) & !empty($_POST)){
$username = mysql_real_escape_string($_POST['username'], $localhost);
$sql = "SELECT * FROM database.users WHERE users.email = '$email'";
$res = mysql_query($sql, $localhost) or die(mysql_error());
$count = mysql_num_rows($res);
if($count == 1){
$r = mysql_fetch_assoc($res);
$username = $r['username'];
$to = $r['email'];
$subject = "Your Recovered Username";
$message = file_get_contents("email_template.html");
$headers = 'From: Your name <info#address.com>';
if(mail($to,$subject,$message,$headers)){
header('Location: username-sent.html');
}else{
echo "Failed to Recover your email, try again";
}
}else{
echo "email does not exist in database";
}
}
?>
<!DOCTYPE html>
<!--[if IE 8 ]><html class="no-js oldie ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]><html class="no-js oldie ie9" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<!-- ====== Basic Page Needs ====== -->
<meta charset="utf-8">
<title>Forgot Username</title>
<!-- ====== Mobile Specs Meta ====== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- ====== CSS ====== -->
<link rel="stylesheet" href="../../css/base.css">
<link rel="stylesheet" href="../../css/vendor.css">
<link rel="stylesheet" href="../../css/main.css">
<link rel="stylesheet" href="../../css/zerogrid.css">
<!-- ====== Java Scripts ====== -->
<script src="../../js/modernizr.js"></script>
<script src="../../js/pace.min.js"></script>
<!-- ====== Favicon ====== -->
<link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon">
<link rel="icon" href="../../favicon.ico" type="image/x-icon">
</head>
<body id="top">
<!-- ====== Header Begin ====== -->
<header>
<div class="header-logo">
Logo
</div>
<a id="header-menu-trigger" href="#0">
<span class="header-menu-text" style="color: white">Menu</span>
<span class="header-menu-icon"></span>
</a>
<nav id="menu-nav-wrap">
<span>Close</span>
<img alt="KBG" src="../../images/logo.png" style="height: 100px;width: 100px;" />
<ul class="nav-list">
<li class="current"><a class="" href="../../index.html">Home</a></li>
<li><a class="" href="../../about.html" title="">About</a></li>
<li>
<a class="" >Services</a>
<div>
<ul>
<li>Service 1</li>
<li>Service 2</li>
<li>Service 3</li>
<li>Service 4</li>
</ul>
</div>
</li>
<li><a class="" href="../../Service5.html" >Service 5</a></li>
<li><a class="" href="../../competition.html" >Competition</a></li>
<li><a class="" href="../../login.php" >Sign In</a></li>
<li><a class="" href="../../signup.html" >Sign Up</a></li>
<li>Contact Us</li>
</ul>
</nav> <!-- end #menu-nav-wrap -->
</header>
<section id="services">
<div class="overlay"></div>
<div class="zerogrid">
<div class="row">
<!--Start Box-->
<div class="col-1-3 offset-1-3">
<div class="wrap-col">
<div class="row">
<div class="animate-this">
<h1 style="color: white">Forgot username?</h1>
<p class="lead" style="color: white">Fill in your email below and we will send you your username.</p>
<?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg; ?> </div><?php } ?>
<?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?>
<form method="post">
<div class="form-field">
<input name="email" style="color: white" class="full-width" type="text" id="email" placeholder="Email" value="" minlength="5" required>
</div>
<div class="form-field">
<input type="submit" class="submitform full-width" style="background-color: white; color: black" value="Send" name="forgotusername">
</div>
Go Back
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer>
<div class="footer-bottom">
<div class="row">
<div class="col-full">
<div class="copyright">
<span>© Copyright Company 2017.</span>
</div>
</div>
</div>
</div>
<div id="go-top">
<a class="smoothscroll" title="Back to Top" href="#top">
<i class="fa fa-long-arrow-up" aria-hidden="true"></i>
</a>
</div>
</footer>
<div id="preloader">
<div id="loader"></div>
</div>
<!-- ====== Java Scripts ====== -->
<script src="../../js/jquery-2.1.3.min.js"></script>
<script src="../../js/plugins.js"></script>
<script src="../../js/main.js"></script>
<script src="../../js/cookiechoices.js"></script>
<script>
cookieChoices.showCookieBar({
linkHref: '../../cookie-policy.html',
language: 'en'
});
</script>
</body>
</html>
this is the code that is sent to the users email "email_template.html"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="https://www.website.com/favicon.png" type="image/x-icon">
<link rel="icon" href="https://www.website.com/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="https://www.website.com/css/base.css">
<link rel="stylesheet" href="https://www.website.com/css/vendor.css">
<link rel="stylesheet" href="https://www.website.com/css/main.css">
<link rel="stylesheet" href="https://www.website.com/css/zerogrid.css">
</head>
<body style="max-width: 100%">
<section style="background-color: black; text-align: center; height: 20%; min-height: 5%"><img src="https://www.website.com/images/logo.png" alt="logo" style="max-height: 150px; max-width: 150px; margin-top: 1%" /></section>
<section id="services">
<div class="overlay"></div>
<div class="zerogrid">
<div class="row">
<!--Start Box-->
<div class="col-1-3 offset-1-3">
<div class="wrap-col">
<div class="row">
<div class="animate-this">
<h1 style="color: white">Forgot Your Username?</h1>
<p class="lead" style="color: white">Not a problem, we've searched our database for your username.</p>
<p class="lead" style="color: white">Your username is:</p>
<div class="form-field">
<input type="button" class="full-width" style="background-color: white; color: black" value="$username">
</div>
<br />
<br />
<p class="lead" style="color: white">Regards,<br />Support Team</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>
Everything does as it should but the username doesn't show up, instead "$username" shows up in the email.
Someone please help. Thanks in advance.
First of all, email_template.html is an .html file, you need to change it to .php file.
Second, you are getting the file contents to variable how would you expect $username variable to be in same scope ?
Probable solution would be :
Get the file content and then replace the $username in your .html file content with $username value.
$message = file_get_contents("email_template.html");
$message = str_replace('$username', $username, $message);
file_get_contents() function does not parse the contents. SO you have to add this line after you get contents into $message :
$message = str_replace('$username', $username, $message);
And I suggest that you replace $username in your html by something like %USERNAME% and you use it like that :
$message = str_replace('%USERNAME%', $username, $message);
You can't use PHP code inside a HTML document. Any PHP code in HTML document will parse as a string.
Change file extension for 'email_template.html' to. Php:
email_template.php
Note that now you will have to use PHP echo to print any HTML. I suggest to read how php works: http://www.php.net
So i have this page setup for my private game server. I host the game server and web on the same dedicated server running windows server 2016. I use IIS to host the website. Right now am facing a problem, page only loads after reloading for 2-3 times. Till then it returns HTTP error 500. Once the page is loaded, i have to refresh multiple times to load each content. What is going on ?
Page -> www.ram-sro.com
Index.php
<?php
include("_incl/config.inc.php");
$sec = new Security();
$conf = new Config();
$mssql = new mssql();
$mssql->dbOpen($conf->accountDbName);
$modDir = "mod/";
$modExt = ".php";
session_start();
?>
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title><?php echo "$conf->siteName" ?></title>
<link type="text/css" rel="stylesheet" media="all" href="css/style.css" />
<link rel="shortcut icon" href="img/favicon.png" type="image/x-icon" />
<meta name="description" content="<?php echo $conf->description; ?>" />
<meta name="keywords" content="<?php echo $conf->keywords; ?>" />
<script type="text/javascript">
<!--
function clearText(formfield){
if (formfield.defaultValue==formfield.value) {
formfield.value = ""
}
}
-->
</script>
</head>
<body>
<center>
<div id="page-body">
<div class="page-body topbox">
<div class="page-body blackspace"></div>
<div class="page-body topbox-content">
<div class="topbox-webtitle">
</div>
<div class="topbox-user">
<div class="social-networks">
<img src="img/fb-icon.png" width="40px" height="40px;" alt="Visit us at facebook!" />
<img src="img/tw-icon.png" width="40px" height="40px;" alt="Visit us at twitter!" />
</div>
<div class="form">
<?php include($modDir."user".$modExt);?>
</div>
</div>
</div>
</div>
<div class="page-body spacer"></div>
<div class="page-body menubox">
<div class="menubox-content">
<div id="menubar">
<ul>
<?php
include($modDir."menu".$modExt);
?>
</ul>
</div>
</div>
</div>
<div class="page-body spacer"></div>
<div class="page-body content">
<div class="page-body leftblock">
<?php
include($modDir."page".$modExt);
?>
</div>
<div class="page-body rightblock">
<?php
include($modDir."social".$modExt);
?>
<div class="page-body spacer"></div>
<div class="page-body info">
<?php
include($modDir."info".$modExt);
?>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</center>
</body>
</html>
First of all, I'm using a child theme for wordpress (TwentyThirteen Parent Theme). I have an image to use as header there is something like this:
So, in black would be my header image (the white part is transparent), in gray I have my menu-bar and in red my first section on content's site.
My problem is... how can I set (with css/bootstrap) to the image header be like this? What's the basic structure for that?
My header.php code is this:
?><!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) & !(IE 8)]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
<![endif]-->
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header" role="banner">
<div class="header">
<?php echo '<img class="img-responsive" src="' . get_stylesheet_directory_uri() . '/img/header.png">';?>
</div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
</div>
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Page 1</li>
<li>Page 2</li>
<li>Page 3</li>
</ul>
</div>
</nav>
</header><!-- #masthead -->
<div id="main" class="site-main">
in twenty thirteen theme site title/description & menu comes under header section so you can add header image section above it. Please refer below example code.
<body <?php body_class(); ?>>
<!-- Here you can add custom header image section outside page div -->
<div class="headerImg1"><img src=""></div> <!-- postion one -->
<div id="page" class="hfeed site">
<!-- or you can also add here inside page div. -->
<div class="headerImg2"><img src=""></div> <!-- postion two -->
<header id="masthead" class="site-header" role="banner">
<!-- site title/description code -->
<div id="navbar" class="navbar">
<nav id="site-navigation" class="navigation main-navigation" role="navigation">
<!-- Nav code -->
</nav><!-- #site-navigation -->
</div><!-- #navbar -->
</header><!-- #masthead -->
<div id="main" class="site-main">
previous page (added as edit)
<!DOCTYPE html>
<html lang="en">
<head>
<script src="jquery-2.1.1.min.js"></script>
<script src="jquery/jquery-ui-1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="jquery/jquery-ui-1.11.2/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap-theme.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap.min.css">
<script src="bootstrap-3.3.1-dist/dist/js/bootstrap.js"></script>
<script src="bootstrap-3.3.1-dist/dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="/CSS/handover.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>IgG Dashboard</title>
<script>
$(document).ready(function() {
// Datepicker Popups calender to Choose date.
$(function() {
$("#datepicker").datepicker({ dateFormat: 'yy-mm-dd' });
});
});
</script>
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="../../assets/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="Dashboard.php">IgG Dashboard</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>Messages</li>
<li>Scripts and Options Editor</li>
<li>Add User</li>
<li id= "dash"><p >Welcome <?php echo " " .$_SESSION['myuser']." ";?><a class="btn bg-info" href="Dashboard.php">Main Site</a></p></li>
</ul>
</div><!-- /.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar -->
<div class="jumbotron">
<div class="container-fluid">
<br>
<br>
<br><br>
<?php
$scripte = ($_POST["scriptake"]);
$scriptot =($_POST["scriptot"]);
include 'config.php';
echo '<h2>'.$scripte.' Equipment</h2>';
echo '<h2>Total Hours '.$scriptot.'</h2>';
echo'<table class="table table-responsive"><tr><form action="equiptest.php" method="post"><th>Script Hour</th><th>Equipment Required</th><th>Stage</th></tr>';
$x = 1;
$p = 1;
$r=1;
while($x <= $scriptot ) {
echo "<tr><td>".$x++."</td><td><input name='equip".$r++."'` ></td><td><input name='stage".$p++."'><input name='ohyeah' type='hidden' value= '".$scriptot."'></td></tr>";
}
echo'<tr><td colspan="2"><input type="submit" class="btn btn-primary"></td></tr></form></table>';
?>
</div>
Can I do this with a post variable. I get undefined. However if I write
equip1 = ($_POST["equip1"]);
echo $equip1;
it works
<?php
$scriptot = ($_POST["ohyeah"]);// working
$y = 1;
$x = 1;
$r= 1;
while($x <= $scriptot ) {//working
${"equip".$x} = ($_POST["equip".$x]); //not working
echo ${"equip" .$x};//not working
$x++; // working
}
I am trying to create dyanmic variables. Idea in this case is to insert POST to database
so want
$equip1
$equip2
$equip3 etc
Thanks
For organizational purposes, you should really use arrays.
For instance, in a form you can set the input name to 'equip[1]' and the value will imported to PHP as $_POST['equip'][1]. Then you can just run:
foreach($_POST['equip'] as $key=>$value) {
# where $key = 1, the $value will be of equip[1]
}
May not be exactly what you're after, but it seems like a much cleaner solution than what you are attempting.
This is how I try.
<?php while ( have_posts() ) : the_post(); ?>
<div class="contentTitle"><?php the_title(); ?></div>
<div class="contentText">
<?php the_content(); ?>
</div>
<?php endwhile ?>