Here i am trying to convert my html and css template in wordpress theme and i have four php files (1) index.php, (2) header.php, (3) feature.php and (4) footer.php.
In index.php files i am getting the other three files using function <?php get_header(); ?>, <?php get_feature (); ?>,<?php get_footer (); ?>.
Now on using function <?php get_header(); ?>,<?php get_footer (); ?> in index.php it shows the header and footer section but on including <?php get_feature (); ?> between header and footer it shows error indicating <?php get_feature (); ?>line saying "Fatal error: Call to undefined function get_feature() in C:\xampp\htdocs\Alvin Lemo\wordpress\wp-content\themes\alvinlimo\index.php on line 2" and does not show the feature section and footer section.
Below is what i have done
In index.php
<?php get_header (); ?>
<?php get_feature(); ?> <!--- Error Showing Line -->
<?php get_footer (); ?>
In header.php
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<!--- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>Alvin Lemo</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Abel" rel="stylesheet">
<!-- Script
================================================== -->
<script src="js/modernizr.js"></script>
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="favicon.png" >
<?php wp_head (); ?>
</head>
<body>
<div id="myNav" class="overlay">
×
<div class="overlay-content">
<div class="container">
<h2 style="color:white">Please Login To Resere Your Fleet With Us</h2><br />
<form>
<div class="form-group">
<input class="form-control" id="email" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter email"><br /><br />
</div>
<div class="form-group">
<input class="form-control" id="pwd" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter password"><br /><br />
</div>
<div class="checkbox">
</div>
<button type="submit" class="btn btn-default">Rserve</button>
</form>
</div>
</div>
</div>
<div id="myNavv" class="overlay">
×
<div class="overlay-content">
<div class="container">
<h2 style="color:white">Please Register To Reserve Your Fleet </h2><br />
<form>
<div class="form-group">
<input class="form-control" id="email" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter FullName"><br /><br />
</div>
<div class="form-group">
<input class="form-control" id="email" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter email"><br /><br />
</div>
<div class="form-group">
<input class="form-control" id="pwd" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter password"><br /><br />
</div>
<button type="submit" class="btn btn-default">Register</button>
</form>
</div>
</div>
</div>
<!-- Header
================================================== -->
<header>
<div class="logo">
<a class="smoothscroll" href="#hero"><!--<img alt="" src="images/logo.png">-->
<h2>A.L.S</h2>
</a>
</div>
<nav id="nav-wrap">
<a class="mobile-btn" href="#nav-wrap" title="Show navigation">Show Menu</a>
<a class="mobile-btn" href="#" title="Hide navigation">Hide Menu</a>
<ul id="nav" class="nav">
<li><a class="smoothscroll" href="#features">EVENT TRANSPORTATION</a></li>
<li><a class="smoothscroll" href="#pricing">Services</a></li>
<li><a class="smoothscroll" href="#screenshots">OUR FLEET</a></li>
<li><a class="smoothscroll" href="#testimonials">Testimonials</a></li>
<li><a class="smoothscroll" href="#subscribe">CONTACT</a></li>
</ul> <!-- end #nav -->
</nav> <!-- end #nav-wrap -->
<ul class="header-social">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-google-plus"></i></li>
</ul>
</header>
<!-- Header End -->
<!-- Homepage Hero
================================================== -->
<section id="hero">
<div class="row">
<div class="twelve columns">
<div class="hero-text">
<br /><br /><br />
<h1 class="responsive-headline">Welcome To Alvin's Limo</h1>
<p>
Little about alivin's limo services.
</p>
</div>
<br />
<div class="buttons">
<a class="button trial" onclick="openNav()">Reserve Fleet</a>
<a class="button learn-more smoothscroll" onclick="openNavv()">Register</a>
</div>
<br /><br /><br /><br /><br /><br /><br />
</div>
</div>
</section>
<!-- Homepage Hero end -->
In feature.php
<!-- Features Section
================================================== -->
<section id='features'>
<div class="row section-head">
<h1>EVENT TRANSPORTATION</h1>
<p>
We Fell Happy To Be Part Of Your Special Ocassion
</p>
</div>
<div class="row feature design">
<div class="six columns right">
<h3> Wedding Transporation</h3>
<p>LMake your "most memorable day" of your life more special by Alvin Wedding Limo Service.
Your weddings transportation will be most beautiful latest model limousine imaginable,
with all the special amenities you desire. Our chauffeurs are always on time, courteous,
and dressed in black suit. Let us take you to the church and from the church to the reception and
from the reception to the airport or any special place in Texas for your honeymoon. You don't need
to worry about coordinating transportation from each destination, we can help arrange your weddings
party pick-ups and drop-offs and everything in between. We do service all the hills country wedding
venues. Feel free to check our wedding reviews - WEDDINGWIRE-THE KNOTT.
</p>
</div>
<div class="six columns feature-media left">
<img src="images/fpt-112704-Wedding-Flowers.jpg" />
</div>
</div>
<div class="row feature responsive">
<div class="six columns left">
<h3>Wine Transportation.</h3>
<p>
Alvin Limousine Services share your passion for wine; that’s why we specialize in hills country
wine tours. We offer a diverse selection of vehicles ranging from sedans, stretch limousines to
transport you affordably in luxury, safety, and style! Leave the driving, directions, stress,
and traffic to us while our Chauffeur whisks you away to your perfect day!
Our impressive customer list is concrete evidence of our ability to outperform our competition,
consistently exceeding our customers’ expectations. We will make your tour the best tour you have
ever known. We have dedicated chauffeur that specialize in wine tours, Brewery and Vodka distillery.
</p>
</div>
<div class="six columns feature-media right">
<img src="images/wine-tours-preferrred-limo.jpg" />
</div>
</div>
<div class="row feature cross-browser">
<div class="six columns right">
<h3>Concert</h3>
<p>
Whether you want to see a Show, Concert, Opera, Symphony or any other fun thing you can think of,
Alvin Limos will provide you personal and reliable chauffeured Limousine.
Reserve luxury town car Sedan or our luxurious stretch limousine for hassle free ride
from navigation, traffic, and struggling the multitude of cars for parking. Roll up with
style to the front door of any events location you desire.
Let the professional Chauffeurs of Alvin Limousine Service take you to your next Concert,
Movie premier, Opera, Symphony or any night out events with comfort and style.
We get you there on time in safely and in style ; Alvin Limo will ensure you have the time of
your life. We are the Leader in providing a full Service Limousine Transportation.
</p>
</div>
<div class="six columns feature-media left">
<img src="images/thenextweb.jpg" />
<!--<img src="images/feature-image-3.png" alt="" />-->
</div>
</div>
<div class="row feature video">
<div class="six columns left">
<h3>ACL/SXSW/Austin 360</h3>
<p>
What you hear is true. With vibrant entertainment and culture, inspiring cuisine and stunning outdoor settings, Austin lets you create a soundtrack all your own. We're home to more than 250 music venues and a vibrant arts scene. So take a look around, and put Live Music Capital of the World® on your playlist. Whether you want to take ride thought Austin or plan a night out with friends and family we will do that in style. Alvin Limousine is a premier transportation when it comes to Austin Texas culture and events. Come one come all and let us drive though the ins and outs of this beautiful happening city.
Alvin Limousine staff are very discrete and confident with all our celebrities and movies stars that we have been transporting for years.
</p>
</div>
<div class="six columns feature-media right">
<img src="images/1ff7f709cd8ef280ec5f2b317f79ba14-2b32e6b5be7f48f4557299fc9db819c3.png" />
</div>
</div>
<div class="row feature cross-browser">
<div class="six columns right">
<h3>Convention Center</h3>
<p>
The Austin Convention Center, a premier facility located in the heart of the capital city’s downtown business district, has emerged as a leader in the convention and meeting industry.
Alvin’s Limousine Services is proud to be part of your success by providing you or your guests with a premier chauffeured services . We can accommodate small or large groups .
- Airport Transportations
- Shuttling your groups through out your meetings
- Advertising your business on our Cars. (Wrap the cars with your Logo or new Product.**Extra Fees apply)
</p>
</div>
<div class="six columns feature-media left">
<img src="images/ARATA_ISOZAKI_RHWL_QNCC_DOHA_QATAR_PAN_060313_0009.jpg" />
</div>
</div>
<div class="row feature responsive">
<div class="six columns left">
<h3>Circuits of America - Formula 1</h3>
<p>
Circuit Of The Americas is a multi-purpose facility that will host the most prestigious racing events in the world, including the Formula 1 United States Grand Prix. It is the first purpose-built Grand Prix facility in the U.S Austin Texas
Circuit of The Americas (COTA) in Austin, Texas, is the home of world championships and a world-class destination for premium sports and entertainment.
Alvin’s Limousine Services is proud to be the leading transportations in Austin Texas, we can provide you or your Guests with many VIP Packages that can suits your needs , from Town car service , SUV’s or Stretch Limousine ,we are your one stop solutions to your transportations for World-Class destination . For International reservations , Please use our 24/7 reservations systems for quick quote and complete reservation confirmed within one hour or you can
Skpe us at : Austinlimo
</p>
</div>
<div class="six columns feature-media right">
<img src="images/bQwIzE.jpg" />
</div>
</div>
<div class="row feature cross-browser">
<div class="six columns right">
<h3>Prom</h3>
<p>
Whether you want to see a Show, Concert, Opera, Symphony or any other fun thing you can think of, Alvin Limos will provide you personal and reliable chauffeured Limousine. Reserve luxury town car Sedan or our luxurious stretch limousine for hassle free ride from navigation, traffic, and struggling the multitude of cars for parking. Roll up with style to the front door of any events location you desire.
Let the professional Chauffeurs of Alvin Limousine Service take you to your next Concert, Movie premier, Opera, Symphony or any night out events with comfort and style.
We get you there on time in safely and in style ; Alvin Limo will ensure you have the time of your life. We are the Leader in providing a full Service Limousine Transportation.
</p>
</div>
<div class="six columns feature-media left">
<img src="images/prom-header.jpg" />
</div>
</div>
</section>
<!-- Features Section end -->
In footer.php
<!-- Footer
================================================== -->
<footer>
<div class="row">
<div class="six columns right-cols">
<div class="row">
<div class="columns">
<h2 class="address">Come Visit</h2>
<p>
7901 Cameron Rd Bldg3 Suite 312, Austin tx 78754<br>
</p>
</div>
<div class="columns last">
<h2 class="contact">Contact Us</h2>
<ul>
<li>512 300 1379</li>
<li>someone#woosite.com</li>
</ul>
</div>
</div>
</div>
<p class="copyright">© 2014 Alvin's Limousine Services | Design by <a>cts-Design Team</a></p>
<div id="go-top">
<a class="smoothscroll" title="Back to Top" href="#hero"><i class="icon-up-open"></i></a>
</div>
</div> <!-- Row End -->
</footer>
<!-- Footer End-->
<?php wp_footer (); ?>
<!-- Java Script
================================================== -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2 /jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.10.2.min.js"><\/script>')</script>
<script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js">
</script>
<script src="js/jquery.flexslider.js"></script>
<script src="js/waypoints.js"></script>
<script src="js/jquery.fittext.js"></script>
<script src="js/jquery.fitvids.js"></script>
<script src="js/imagelightbox.js"></script>
<script src="js/jquery.prettyPhoto.js"></script>
<script src="js/main.js">
</script>
</body>
</html>
Functions like get_header() and get_footer() are predefined WordPress functions. To get custom part of template we use
<?php get_template_part( string $slug, string $name = null ) ?>
As stated in documentation, patterns it uses to find files are:
{slug}.php
{slug}-{name}.php
If the theme contains no specified file then no template will be included.
The template is included using require, not require_once, so you may include the same template part multiple times.
Finally, this one should load your feature template:
<?php get_template_part( 'feature' ) ?>
Source: https://developer.wordpress.org/reference/functions/get_template_part/
You try to use an undefined function, that is maybe coming from a third party plugin. get_feature() is not a native WordPress function.
If you want to display the featured image, you can use get_the_post_thumbnail() (more details
Hope it helps
Related
I'm trying to fetch local product description file,
In products page while cone clicks on Read more option for full product description, it shows error404 page not found.
The local product file path is resources/views/html/products/chili.blade.php, here product is chili.
<div class="col-md-4 services-grid">
<div class="history-grid-image">
<img src="images/Chilli Farm.jpg" class="img-responsive" alt="">
</div>
<div class="services-info">
<h4>Chili</h4>
<p>The Chili pepper is the fruit of plants from the genus capsicum which are members of nightshade family Solanaceae.
<!-- Chili is extremely popular in India as it brings heat to the food. -->
<!-- India having a rich history of spices and mostly chili finds a place in every dish of Indian food.<br> -->
<!-- Medicinal properties: Capsaicin is the chemical used in plain reliever ointment.
Capsaicin also used in pepper spray and tear gas as chemical irritants to control the crowd in an emergency situation. -->
<!-- Rich in : vitamin B6, vitamin A, iron, copper, potassium and a small amount of protein and carbohydrates.<br> -->
<!-- Helps in digestion, Weight loss, No Cholesterol Content. -->
<!-- Good for Diabetic people. -->
<!-- Fact : Chili was first introduced to India by the Portuguese towards the end of the century.</p> -->
<a class="more" href="{{ url('products-chili') }}"> Read More</a>
</div>
</div>
Here's product description file
#extends("layouts.html")
#section("title", "Chili|GreenGoodsExports")
#section("chili")
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--banner-->
<div class="banner-1">
</div>
<!--//banner-->
<!--single-page-->
<div class="single">
<div class="container">
<h2 class="tittle-one">Chili</h2>
<div class="single-page-artical">
<div class="artical-content">
<h4>Chili</h4>
<img class="img-responsive" src="images/Chilli Farm.jpg" alt=" " style="visibility: visible; animation-delay: 0.5s; animation-name: zoomIn;">
<p>The Chili pepper is the fruit of plants from the genus capsicum which are members of nightshade family Solanaceae.
Chili is extremely popular in India as it brings heat to the food.
India having a rich history of spices and mostly chili finds a place in every dish of Indian food.<br>
Medicinal properties: Capsaicin is the chemical used in plain reliever ointment.
Capsaicin also used in pepper spray and tear gas as chemical irritants to control the crowd in an emergency situation.
Rich in : vitamin B6, vitamin A, iron, copper, potassium and a small amount of protein and carbohydrates.<br>
Helps in digestion, Weight loss, No Cholesterol Content.
Good for Diabetic people.
Fact : Chili was first introduced to India by the Portuguese towards the end of the century.</p>
</div>
<div class="artical-links">
<ul>
<li><i class="glyphicon glyphicon-calendar" aria-hidden="true"></i><span>March 10, 2016</span></li>
<li><i class="glyphicon glyphicon-user" aria-hidden="true"></i><span>admin</span></li>
<li><i class="glyphicon glyphicon-envelope" aria-hidden="true"></i><span>No comments</span></li>
<li><i class="glyphicon glyphicon-share" aria-hidden="true"></i><span>View posts</span></li>
</ul>
</div>
<div class="comment-grid-top">
<h3>Responses</h3>
<div class="comments-top-top">
<div class="top-comment-left">
<img class="img-responsive" src="images/co.png" alt="">
</div>
<div class="top-comment-right">
<ul>
<li><span class="left-at">Admin</span></li>
<li><span class="right-at">March 10, 2016 at 10.30am</span></li>
<li><a class="reply" href="#">Reply</a></li>
</ul>
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
</div>
<div class="clearfix"> </div>
</div>
<div class="comments-top-top top-grid-comment">
<div class="top-comment-left">
<img class="img-responsive" src="images/co.png" alt="">
</div>
<div class="top-comment-right">
<ul>
<li><span class="left-at">Admin</span></li>
<li><span class="right-at">March 18, 2016 at 10.30am</span></li>
<li><a class="reply" href="#">Reply</a></li>
</ul>
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
</div>
<div class="clearfix"> </div>
</div>
</div>
<div class="artical-commentbox">
<h3>leave a comment</h3>
<div class="table-form">
<form>
<input placeholder="Name" type="text" required="">
<input placeholder="Email" type="email" required="">
<input placeholder="Phone" type="text" required="">
<textarea placeholder="Message"></textarea>
<input type="submit" value="Send">
</form>
</div>
</div>
</div>
</div>
</div>
<!--single-page-->
</body>
</html>
#endsection
Here's web.php code
Route::get("/products/chili", "ProductsController#chili")->name('products-chili');
Here's ProductsController.php code
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ProductsController extends Controller
{
public function chili() {
return view("html.products1.chili");
}
Please help me out, thanks...
In you return view is it not suppose to be
return view("html.products.chili");
instead of
return view("html.products1.chili");
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ProductsController extends Controller
{
public function chili() {
return view("html.products.chili");
}
}
For the #extends('layouts.html') to be effective there must be a #yield('chili') in your html.blade.php which will yield the content of the 'chili' section from your chili.blade.php
NB: html.blade.php contains all the required CSS and JS files
see below:
For your html.blade.php
<!DOCTYPE html>
<html>
<head>
<!--include-all-your-head-contents-including-meta-tags-css-links-and-js-->
#yield('title')
</head>
<body>
#yield('chili')
<!--include-all-your-scripts-required-->
</body>
</html>
For your chili.blade.php
#extends('layouts.html')
#section("title", "Chili|GreenGoodsExports")
#section("chili")
<!--banner-->
<div class="banner-1">
</div>
<!--//banner-->
<!--single-page-->
<div class="single">
<div class="container">
<h2 class="tittle-one">Chili</h2>
<div class="single-page-artical">
<div class="artical-content">
<h4>Chili</h4>
<img class="img-responsive" src="images/Chilli Farm.jpg" alt=" " style="visibility: visible; animation-delay: 0.5s; animation-name: zoomIn;">
<p>The Chili pepper is the fruit of plants from the genus capsicum which are members of nightshade family Solanaceae.
Chili is extremely popular in India as it brings heat to the food.
India having a rich history of spices and mostly chili finds a place in every dish of Indian food.<br>
Medicinal properties: Capsaicin is the chemical used in plain reliever ointment.
Capsaicin also used in pepper spray and tear gas as chemical irritants to control the crowd in an emergency situation.
Rich in : vitamin B6, vitamin A, iron, copper, potassium and a small amount of protein and carbohydrates.<br>
Helps in digestion, Weight loss, No Cholesterol Content.
Good for Diabetic people.
Fact : Chili was first introduced to India by the Portuguese towards the end of the century.</p>
</div>
<div class="artical-links">
<ul>
<li><i class="glyphicon glyphicon-calendar" aria-hidden="true"></i><span>March 10, 2016</span></li>
<li><i class="glyphicon glyphicon-user" aria-hidden="true"></i><span>admin</span></li>
<li><i class="glyphicon glyphicon-envelope" aria-hidden="true"></i><span>No comments</span></li>
<li><i class="glyphicon glyphicon-share" aria-hidden="true"></i><span>View posts</span></li>
</ul>
</div>
<div class="comment-grid-top">
<h3>Responses</h3>
<div class="comments-top-top">
<div class="top-comment-left">
<img class="img-responsive" src="images/co.png" alt="">
</div>
<div class="top-comment-right">
<ul>
<li><span class="left-at">Admin</span></li>
<li><span class="right-at">March 10, 2016 at 10.30am</span></li>
<li><a class="reply" href="#">Reply</a></li>
</ul>
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
</div>
<div class="clearfix"> </div>
</div>
<div class="comments-top-top top-grid-comment">
<div class="top-comment-left">
<img class="img-responsive" src="images/co.png" alt="">
</div>
<div class="top-comment-right">
<ul>
<li><span class="left-at">Admin</span></li>
<li><span class="right-at">March 18, 2016 at 10.30am</span></li>
<li><a class="reply" href="#">Reply</a></li>
</ul>
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum is that it has a more-or-less </p>
</div>
<div class="clearfix"> </div>
</div>
</div>
<div class="artical-commentbox">
<h3>leave a comment</h3>
<div class="table-form">
<form>
<input placeholder="Name" type="text" required="">
<input placeholder="Email" type="email" required="">
<input placeholder="Phone" type="text" required="">
<textarea placeholder="Message"></textarea>
<input type="submit" value="Send">
</form>
</div>
</div>
</div>
</div>
</div>
<!--single-page-->
#endsection
You can see more here: https://laravel.com/docs/7.x/blade
I have code for filtration. But the data which filtered was static data. Now I want that data comes from database. Here I shown code snippet for that.
here is the script:
<script>
$('document').ready(function(){
$('#demo').jplist({
itemsBox: '.list'
,itemPath: '.list-item'
,panelPath: '.jplist-panel'
});
});
</script>
and this is the html design:
<div
class="jplist-group"
data-control-type="checkbox-group-filter"
data-control-action="filter"
data-control-name="themes">
<input
data-path=".architecture"
id="architecture"
type="checkbox"
/>
<label for="architecture">Architecture</label>
<input
data-path=".christmas"
id="christmas"
type="checkbox"
/>
<label for="christmas">Christmas</label>
</div>
<!-- item 1 -->
<div class="list-item box">
<!-- img -->
<div class="img left">
<img src="img/thumbs/arch-2.jpg" alt="" title=""/>
</div>
<!-- data -->
<div class="block right">
<p class="date">03/18/2012</p>
<p class="title">Architecture</p>
<p class="desc">Architecture is both the process and product of planning, designing and construction. Architectural works, in the material form of buildings, are often perceived as cultural symbols and as works of art. Historical civilizations are often identified with their surviving architectural achievements.</p>
<p class="like">25 Likes</p>
<p class="theme">
<span class="architecture">Architecture</span>,
<span class="brown">Brown</span>
</p>
</div>
</div>
Thanks in advance.
first of all before I start excuse my mysql I know it's depreciated and I will update to PDO in the future. So here we go.
Basically I have duplicates of most of my pages, 'index.php', 'index2.php' so on and so forth. Basically right now all the pages without the number '2' are non registered users and once a user logs in they will be redirected to 'index2.php' and so all the number with '2' are registered users pages. So what I basically wanted to do is instead of having duplicate pages am I able to just have 'index.php' and other pages without duplicates? So user logs in will be redirected to 'index.php' but have the same features and 'index2.php'. If that makes any sense haha!
Registration page code:
<?php
session_start();
include ('../includes/config.php');
include ('../includes/header.php');
?>
<!doctype html>
<html>
<body>
<div class="search1">
<h2>Register</h2>
<form action="" method="POST">
<center>
<label>Username:</label>
<input type="text" name="username" required />
<label>Password:</label>
<input type="password" name="password" required />
<label>Email:</label>
<input type="email" name="email" required />
<input type="submit" value="Register" name="submit" class="submit" />
</center>
<br><br><br>
<h2><p>Back</p></h2>
</div>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
$password = strip_tags($password);
$password = md5($password); // md5 is used to encrypt your password to make it more secure.
$con=mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('aha') or die("cannot select DB");
$query=mysql_query("SELECT * FROM login WHERE username='".$username."'");
$numrows=mysql_num_rows($query);
if($numrows==0)
{
$sql="INSERT INTO login(username,password,email) VALUES('$username','$password', '$email')";
$result=mysql_query($sql);
if($result){
echo "<div class='passed'>Account Successfully Created</div>";
} else {
echo "<div class='results'>Failure!</div>";
}
} else {
echo "<div class='results'>Username already exists!</div>";
}
} else {
echo "<div class='results'>All fields are required!</div>";
}
}
?>
</form>
<img src="../images/main.jpg">
</body>
</html>
INDEX1.PHP-CODE:
<?php
session_start();
include ('../includes/config.php');
include ('../includes/header.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda |</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--slider-->
<link href="../css/camera.css" rel="stylesheet" type="text/css" media="all" />
<script type='text/javascript' src='../js/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.mobile.customized.min.js'></script>
<script type='text/javascript' src='../js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='../js/camera.min.js'></script>
<script>
jQuery(function(){
jQuery('#camera_wrap_1').camera({
thumbnails: true
});
jQuery('#camera_wrap_2').camera({
height: '400px',
loader: 'bar',
pagination: false,
thumbnails: true
});
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li class="active"><span>Home</span></li>
<li><span>About</span></li>
<li class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
</ul>
<div class="search">
<h2>search</h2>
<form action="search.php" method="get">
<input type="text" name="search" value="" placeholder="Enter Your search...">
<input type="submit" name="submit" value="">
</form>
</div>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$password = strip_tags($password);
$password = md5($password); // md5 is used to encrypt your password to make it more secure.
$query=mysql_query("SELECT * FROM login WHERE username='".$username."' AND password='".$password."'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row=mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
if($username == $dbusername && $password == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$username;
/* Redirect browser */
header("Location: member.php");
}
} else {
echo "<div class='results'>Invalid username or password</div>";
}
} else {
echo "All fields are required!";
}
}
?>
<div class="search1">
<h2>login/Register</h2>
<form action="" method="POST">
<label>Username:</label>
<input type="text" id="password" name="username" required />
<label>Password:</label>
<input type="password" id="password" name="password" required />
<input type="submit" value="Login" name="submit" class="submit" />
<br><br>
<center>
<h2><p>Register</p></h2>
</center>
</form>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start slider -->
<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<div data-thumb="../images/thumbs/slider1.jpg" data-src="../images/slider/slider1.jpg">
</div>
<div data-thumb="../images/thumbs/slider2.jpg" data-src="../images/slider/slider2.jpg">
</div>
<div data-thumb="../images/thumbs/slider3.jpg" data-src="../images/slider/slider3.jpg">
</div>
<div data-thumb="../images/thumbs/slider4.jpg" data-src="../images/slider/slider4.jpg">
</div>
</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<!-- start content_right -->
<div class="image group">
<div class="grids_of_2">
<div class="grid images_3_of_1">
<img src="../images/pic1.jpg">
</div>
<div class="grid span_2_of_3">
<h3>How it all started</h3>
<p class="para">Honda Motor Co., Ltd. (本田技研工業株式会社 Honda Giken Kōgyō KK?, IPA: [hoɴda] ( listen); /ˈhɒndə/) is a Japanese public multinational corporation primarily known as a manufacturer of automobiles, motorcycles and power equipment.
Honda has been the world's largest motorcycle manufacturer since 1959,[3][4] as well as the world's largest manufacturer of internal combustion engines measured by volume, producing more than 14 million internal combustion engines each year.[5] Honda became the second-largest Japanese automobile manufacturer in 2001.[6][7] Honda was the eighth largest automobile manufacturer in the world behind General Motors, Volkswagen Group, Toyota, Hyundai Motor Group, Ford, Nissan, and PSA in 2011.[8]
Honda was the first Japanese automobile manufacturer to release a dedicated luxury brand, Acura, in 1986. Aside from their core automobile and motorcycle businesses, Honda also manufactures garden equipment, marine engines, personal watercraft and power generators, amongst others. Since 1986, Honda has been involved with artificial intelligence/robotics research and released their ASIMO robot in 2000. They have also ventured into aerospace with the establishment of GE Honda Aero Engines in 2004 and the Honda HA-420 HondaJet, which began production in 2012. Honda has three joint-ventures in China (Honda China, Dongfeng Honda, and Guangqi Honda).
In 2013, Honda invested about 5.7% (US$ 6.8 billion) of its revenues in research and development.[9] Also in 2013, Honda became the first Japanese automaker to be a net exporter from the United States, exporting 108,705 Honda and Acura models while importing only 88,357</p>
</div>
<div class="clear"></div>
</div>
<div class="grids_of_2 top">
<div class="grid images_3_of_1">
<img src="../images/pic2.jpg">
</div>
<div class="grid span_2_of_3">
<h3>CEO of Honda</h3>
<p class="para">Kawamoto acted quickly to change Honda's corporate culture, rushing through market-driven product development that resulted in recreational vehicles such as the Odyssey[disambiguation needed] and the CR-V, and a refocusing away from some of the numerous sedans and coupes that were popular with Honda's engineers but not with the buying public. The most shocking change to Honda came when Kawamoto ended Honda's successful participation in Formula One after the 1992 season, citing costs in light of the takeover threat from Mitsubishi as well as the desire to create a more environmentally-friendly company image.[21]
Later, 1995 gave rise to the Honda Aircraft Company with the goal of producing jet aircraft under Honda's name</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</center>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="copy">
<p class="w3-link">© </p>
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>
Least but not last! INDEX2.PHP-CODE:
<?php
session_start();
include "../includes/config.php";
include "function.php";
include ('../includes/header.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<style>
#error_box{display:none; position:relative;top:-25px}
</style>
<title>Honda |</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--slider-->
<link href="../css/camera.css" rel="stylesheet" type="text/css" media="all" />
<script type='text/javascript' src='../js/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.mobile.customized.min.js'></script>
<script type='text/javascript' src='../js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='../js/camera.min.js'></script>
<script>
jQuery(function(){
jQuery('#camera_wrap_1').camera({
thumbnails: true
});
jQuery('#camera_wrap_2').camera({
height: '400px',
loader: 'bar',
pagination: false,
thumbnails: true
});
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li class="active"><span>Home</span></li>
<li><span>About</span></li>
<li class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
</ul>
<div class="search">
<h2>search</h2>
<form>
<input type="text" value="" placeholder="Enter Your search...">
<input type="submit" value="">
</form>
</div>
<div class="search1">
<form action="" method="POST">
<br>
<h2>Welcome, <?=$_SESSION['sess_user'];?>!</h2><br><br>
<div class="pw">
<h3>Change details</h3>
</div>
<br><br>
<h2>Logout</h2>
</form>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start slider -->
<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<div data-thumb="../images/thumbs/slider1.jpg" data-src="../images/slider/slider1.jpg">
</div>
<div data-thumb="../images/thumbs/slider2.jpg" data-src="../images/slider/slider2.jpg">
</div>
<div data-thumb="../images/thumbs/slider3.jpg" data-src="../images/slider/slider3.jpg">
</div>
<div data-thumb="../images/thumbs/slider4.jpg" data-src="../images/slider/slider4.jpg">
</div>
</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<!-- start content_right -->
<div class="image group">
<div class="grids_of_2">
<div class="grid images_3_of_1">
<img src="../images/pic1.jpg">
</div>
<div class="grid span_2_of_3">
<h3>How it all started</h3>
<p class="para">Honda Motor Co., Ltd. (本田技研工業株式会社 Honda Giken Kōgyō KK?, IPA: [hoɴda] ( listen); /ˈhɒndə/) is a Japanese public multinational corporation primarily known as a manufacturer of automobiles, motorcycles and power equipment.
Honda has been the world's largest motorcycle manufacturer since 1959,[3][4] as well as the world's largest manufacturer of internal combustion engines measured by volume, producing more than 14 million internal combustion engines each year.[5] Honda became the second-largest Japanese automobile manufacturer in 2001.[6][7] Honda was the eighth largest automobile manufacturer in the world behind General Motors, Volkswagen Group, Toyota, Hyundai Motor Group, Ford, Nissan, and PSA in 2011.[8]
Honda was the first Japanese automobile manufacturer to release a dedicated luxury brand, Acura, in 1986. Aside from their core automobile and motorcycle businesses, Honda also manufactures garden equipment, marine engines, personal watercraft and power generators, amongst others. Since 1986, Honda has been involved with artificial intelligence/robotics research and released their ASIMO robot in 2000. They have also ventured into aerospace with the establishment of GE Honda Aero Engines in 2004 and the Honda HA-420 HondaJet, which began production in 2012. Honda has three joint-ventures in China (Honda China, Dongfeng Honda, and Guangqi Honda).
In 2013, Honda invested about 5.7% (US$ 6.8 billion) of its revenues in research and development.[9] Also in 2013, Honda became the first Japanese automaker to be a net exporter from the United States, exporting 108,705 Honda and Acura models while importing only 88,357</p>
</div>
<div class="clear"></div>
</div>
<div class="grids_of_2 top">
<div class="grid images_3_of_1">
<img src="../images/pic2.jpg">
</div>
<div class="grid span_2_of_3">
<h3>CEO of Honda</h3>
<p class="para">Kawamoto acted quickly to change Honda's corporate culture, rushing through market-driven product development that resulted in recreational vehicles such as the Odyssey[disambiguation needed] and the CR-V, and a refocusing away from some of the numerous sedans and coupes that were popular with Honda's engineers but not with the buying public. The most shocking change to Honda came when Kawamoto ended Honda's successful participation in Formula One after the 1992 season, citing costs in light of the takeover threat from Mitsubishi as well as the desire to create a more environmentally-friendly company image.[21]
Later, 1995 gave rise to the Honda Aircraft Company with the goal of producing jet aircraft under Honda's name</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</center>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="copy">
<p class="w3-link">© </p>
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>
Any help is greatly appreciated! Thanks!
This is a really poor design, but i hope, you will get the logic.
session_start();
if (!empty($_POST["username"]) && !empty($_POST["password"])) {
//If form has submitted
//Get user from database.
if ($numrows > 0) {
$_SESSION["loggedIn"] = true;
//You can set here more session things, like username, email, etc...
} else {
$_SESSION["loggedIn"] = false;
}
}
if (empty($_SESSION["loggedIn"])) {
//Show content if user is not logged in.
//You can include your file here, when user not logged in
} else {
//Show content if user is logged in.
//You can include your file here
//The best practice, if you are redirect to the user here to another page.
//Do this check in all page, when user needs to be logged in
}
//HTML code comes here.
Hi there I'm just trying to figure out how to check if a user is logged in and if so allow them to enter a page but if not simply return to 'index.php'.
What I've basically done is create duplicate pages of such as 'index.php', 'index2.php', 'service.php' and 'service2.php' so on and so forth with minor adjustments such as no 'search bar'.
Is it still possible to do so? I'd like the 'Check to see if logged in' on pages with '2' in them. Such as 'service2.php' or 'about2.php'
I've tried it with this code
(Keep in mind this is just the code not my whole entire page)
if(check_login()) {
echo 'You are in!';
} else {
header('Location: login.php');
exit;
}
function check_login () {
if(isset($_SESSION['login'] && $_SESSION['login'] != '') {
return true;
} else {
false;
}
}
Only used this code on pages that I want it to be displayed
Thanks in advance ! :)
UPDATE EDIT:
<?php
include ('config.php');
include ('function.php');
$_SESSION['login']
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda | </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--slider-->
<link href="../css/camera.css" rel="stylesheet" type="text/css" media="all" />
<script type='text/javascript' src='../js/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.mobile.customized.min.js'></script>
<script type='text/javascript' src='../js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='../js/camera.min.js'></script>
<script>
jQuery(function(){
jQuery('#camera_wrap_1').camera({
thumbnails: true
});
jQuery('#camera_wrap_2').camera({
height: '400px',
loader: 'bar',
pagination: false,
thumbnails: true
});
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li class="active"><span>Home</span></li>
<li><span>About</span></li>
<li class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
</ul>
<div class="search">
<h2>search</h2>
<form action="search.php" method="get">
<input type="text" name="search" value="" placeholder="Enter Your search...">
<input type="submit" name="submit" value="">
</form>
</div>
<div class="search1">
<h2>login/Register</h2>
<form action="" method="POST">
<label>Username:</label>
<input type="text" id="password" name="username" required />
<label>Password:</label>
<input type="password" id="password" name="password" required />
<input type="submit" value="Login" name="submit" class="submit" />
<br><br>
<center>
<h2><p>Register</p></h2>
</center>
</form>
</div>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$password = strip_tags($password);
$password = md5($password); // md5 is used to encrypt your password to make it more secure.
$con=mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('aha') or die("cannot select DB");
$query=mysql_query("SELECT * FROM login WHERE username='".$username."' AND password='".$password."'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row=mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
if($username == $dbusername && $password == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$username;
/* Redirect browser */
header("Location: member.php");
}
} else {
echo "<div class='results'>Invalid username or password</div>";
}
} else {
echo "All fields are required!";
}
}
?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start slider -->
<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<div data-thumb="../images/thumbs/slider1.jpg" data-src="../images/slider/slider1.jpg">
</div>
<div data-thumb="../images/thumbs/slider2.jpg" data-src="../images/slider/slider2.jpg">
</div>
<div data-thumb="../images/thumbs/slider3.jpg" data-src="../images/slider/slider3.jpg">
</div>
<div data-thumb="../images/thumbs/slider4.jpg" data-src="../images/slider/slider4.jpg">
</div>
</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<!-- start content_right -->
<div class="image group">
<div class="grids_of_2">
<div class="grid images_3_of_1">
<img src="../images/pic1.jpg">
</div>
<div class="grid span_2_of_3">
<h3>How it all started</h3>
<p class="para">Honda Motor Co., Ltd. (本田技研工業株式会社 Honda Giken Kōgyō KK?, IPA: [hoɴda] ( listen); /ˈhɒndə/) is a Japanese public multinational corporation primarily known as a manufacturer of automobiles, motorcycles and power equipment.
Honda has been the world's largest motorcycle manufacturer since 1959,[3][4] as well as the world's largest manufacturer of internal combustion engines measured by volume, producing more than 14 million internal combustion engines each year.[5] Honda became the second-largest Japanese automobile manufacturer in 2001.[6][7] Honda was the eighth largest automobile manufacturer in the world behind General Motors, Volkswagen Group, Toyota, Hyundai Motor Group, Ford, Nissan, and PSA in 2011.[8]
Honda was the first Japanese automobile manufacturer to release a dedicated luxury brand, Acura, in 1986. Aside from their core automobile and motorcycle businesses, Honda also manufactures garden equipment, marine engines, personal watercraft and power generators, amongst others. Since 1986, Honda has been involved with artificial intelligence/robotics research and released their ASIMO robot in 2000. They have also ventured into aerospace with the establishment of GE Honda Aero Engines in 2004 and the Honda HA-420 HondaJet, which began production in 2012. Honda has three joint-ventures in China (Honda China, Dongfeng Honda, and Guangqi Honda).
In 2013, Honda invested about 5.7% (US$ 6.8 billion) of its revenues in research and development.[9] Also in 2013, Honda became the first Japanese automaker to be a net exporter from the United States, exporting 108,705 Honda and Acura models while importing only 88,357</p>
</div>
<div class="clear"></div>
</div>
<div class="grids_of_2 top">
<div class="grid images_3_of_1">
<img src="../images/pic2.jpg">
</div>
<div class="grid span_2_of_3">
<h3>CEO of Honda</h3>
<p class="para">Kawamoto acted quickly to change Honda's corporate culture, rushing through market-driven product development that resulted in recreational vehicles such as the Odyssey[disambiguation needed] and the CR-V, and a refocusing away from some of the numerous sedans and coupes that were popular with Honda's engineers but not with the buying public. The most shocking change to Honda came when Kawamoto ended Honda's successful participation in Formula One after the 1992 season, citing costs in light of the takeover threat from Mitsubishi as well as the desire to create a more environmentally-friendly company image.[21]
Later, 1995 gave rise to the Honda Aircraft Company with the goal of producing jet aircraft under Honda's name</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</center>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="copy">
<p class="w3-link">© </p>
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>
You are missing a paranthesis in the isset in the check login function, also the function could be made simpler.
// I'd also put this function in some common file.
function check_login() {
return isset($_SESSION['login']) && $_SESSION['login'] != '';
}
// then in all other files you could include the common file, and do this
if (!check_login()) {
header('Location: login.php');
exit;
}
The best experience in this case will be to put check_login into smth like functions.php and insert this in files where you want to use it:
include "functions.php";
if(!check_login()) {
header('Location: login.php');
exit();
}
You can also try using Apache's native module mod_rewrite to handle large amount of such suffixed files.
I am new to php and I want to only show specific footer content on 2 pages.
I know I would use an if statement, but I don't know if there is way in php to know what page is being displayed.
Here is the footer.php
<?php
/**
* The template for displaying the footer.
*
* Contains the closing of the id=main div and all content after
*
* #package WordPress
* #subpackage Twenty_Eleven
* #since Twenty Eleven 1.0
*/
?>
</div><!-- #main -->
<footer id="colophon" role="contentinfo">
<?php
/* A sidebar in the footer? Yep. You can can customize
* your footer with three columns of widgets.
*/
get_sidebar( 'footer' );
?>
<div class="boli-better">
<h1 class="description-title">WHY IS BOLI BETTER?</h1>
<div class="feature feature-item-248"><img class="main" src="http://www.btylus.com/wp-content/uploads/uclaproduct.png" alt="" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">PERFECTLY WEIGHTED</h2>
</div>
<div class="feature_description_content">
Touch screens have simplified technology, but there has yet to be a way to capture the precision of a calligrapher or the stroke of an artist. Not only should it meet your needs, but a stylus should have style.
</div>
</div>
</div>
<div class="feature feature-item-252"><img class="main" src="http://www.bylus.com/wp-content/uploads/bolitip.png" alt="" width="640" height="301" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">PEN-LIKE PRECISION</h2>
</div>
<div class="feature_description_content">
Your stylus should be as sharp as your ideas. The thin and clear disc gives you the accuracy you want in a digital pen.
</div>
</div>
</div>
<div class="feature feature-item-254">
<img class="main" src="http://www.bylus.com/wp-content/uploads/blueproduct.png" alt="" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">BALL POINT</h2>
</div>
<div class="feature_description_content">
Hold your stylus at the angle you’re most comfortable with. Jot gives you the freedom to write or sketch like you’re used to.
</div>
</div>
</div>
<div class="feature feature-item-256">
<img class="main" src="http://www.btylus.com/wp-content/uploads/greenproduct.png" alt="" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">HEAVY METAL</h2>
</div>
<div class="feature_description_content">
Once Jot is in your grip, the quality is unmistakable. The durable aluminum and steel gives Jot superior conductivity and craftsmanship comparable to any luxury pen.
</div>
</div>
</div>
</div>
<div id="site-generator">
<strong id="footertext">Copyright Boli Stylus 2011</strong>
Contact Us
Terms
</div>
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
Ok, so this is what I came up with, but when I add this code to the footer.php, the entire footer doesn't appear on the site.
I'm sure I just made an elementary mistake so thanks for the help in advance!
<?php
$page = 'shop';
if (is_page($page)) { ?>
<div class="boli-better">
<h1 class="description-title">WHY IS BOLI BETTER?</h1>
<div class="feature feature-item-248"><img class="main" src="http://www.bylus.com/wp-content/uploads/uclaproduct.png" alt="" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">PERFECTLY WEIGHTED</h2>
</div>
<div class="feature_description_content">
Touch screens have simplified technology, but there has yet to be a way to capture the precision of a calligrapher or the stroke of an artist. Not only should it meet your needs, but a stylus should have style.
</div>
</div>
</div>
<div class="feature feature-item-252"><img class="main" src="http://www.bylus.com/wp-content/uploads/bolitip.png" alt="" width="640" height="301" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">PEN-LIKE PRECISION</h2>
</div>
<div class="feature_description_content">
Your stylus should be as sharp as your ideas. The thin and clear disc gives you the accuracy you want in a digital pen.
</div>
</div>
</div>
<div class="feature feature-item-254">
<img class="main" src="http://www.btylus.com/wp-content/uploads/blueproduct.png" alt="" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">BALL POINT</h2>
</div>
<div class="feature_description_content">
Hold your stylus at the angle you’re most comfortable with. Jot gives you the freedom to write or sketch like you’re used to.
</div>
</div>
</div>
<div class="feature feature-item-256">
<img class="main" src="http://www.bylus.com/wp-content/uploads/greenproduct.png" alt="" />
<div class="feature_description">
<div class="feature_description_header">
<h2 class="descript-heading">HEAVY METAL</h2>
</div>
<div class="feature_description_content">
Once Jot is in your grip, the quality is unmistakable. The durable aluminum and steel gives Jot superior conductivity and craftsmanship comparable to any luxury pen.
</div>
</div>
</div>
</div>;
<?php
}
?>
Have a look at PHP's server variables. You are probably looking for $_SERVER['REQUEST_URI'].
if ($_SERVER['REQUEST_URI'] == "/index.php") {
echo "My stuff to show on /index.php";
}
Check out the WP Codex. I thing is_page() is what you are looking for: http://codex.wordpress.org/Function_Reference/is_page
You can either set a special variable on pages where you would like to check it (and use it in an if statement for the footer), or use the answer by #Christofer Eliasson, which uses the server's REQUEST_URI variable
what you want is:
<?php
if (is_page(array('page1','page2'))) {
<!-- Fotter content displayed here -->
}
?>