Jump to content

New to PhP, Help setting up Header.tpl and Footer.tpl


BrandonBarker

Recommended Posts

Hello Freaks! im looking to set up a header.tpl and a footer.tpl on a new website i want to make, i was wondering if there was a template anywhere that has these? or what files to edit and put the tpl locations in? i need help :P I dont want to have to change each page header and footer for every change i make.

Thank you in advance people 

Link to comment
Share on other sites

 

<?php include '/pathtoheader/header.tpl';?>
Your page content here
<?php include '/pathtofooter/footer.tpl';?>

 

I would add one step before that. (As long as you are learning, learn the "best practices"):

 

 
<?php
/* All page processing including:
    * Retrieve page parameters
    * Validate user supplied data
    * Retrieve data from database
    * Process data ...
*/
include '/pathtoheader/header.tpl';

/* Your page content here
  (HTML with a sprinkling of PHP to echo data) */

include '/pathtofooter/footer.tpl';
Link to comment
Share on other sites

I would add one step before that. (As long as you are learning, learn the "best practices"):

 

 
<?php
/* All page processing including:
    * Retrieve page parameters
    * Validate user supplied data
    * Retrieve data from database
    * Process data ...
*/
include '/pathtoheader/header.tpl';

/* Your page content here
  (HTML with a sprinkling of PHP to echo data) */

include '/pathtofooter/footer.tpl';

DavidAM is right and don't forget session_start(); if you are using sessions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.