• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Help. How to have same layout for every page..

thegoatherder13

New Member
I am wondering how and the easiest way to get the same layout for everypage. Like say I have a bunch of pages and change one link on my menu bar, how do I make it change on every other page without going to each page and changing it? Someone please help, its appreciated!
 
that can be done with any number of scripting languages [php, ssi, etc...].

some real simple ways to do it:



php [.php extension]:
PHP:
<?php
include "/path/to/header.php";
?>

Main text here

<?
include "/path/to/footer.php";
exit;
?>



ssi [.shtml extension]:
Code:
<!--#include virtual="/path/to/header.shtml" -->

Main text here

<!--#include virtual="/path/to/footer.shtml" -->

then you'd just edit the single header or footer files, and the changes are seen sitewide.
 
Last edited:
Originally posted by JKola
I feel..dumb.. I dont no much about "Php" do you know any place where I can get help?..:D
This question should be in here, but anyway:
www.php.net, www.phpbuilder.com, www.zend.com, and so on :)
I would also recommend you some books, but.. :) Do you really want to learn it? :p
If you want to include also some layouts into your pages, you should only create the script showed above. But your host should support PHP ;)
 
I've been trying to get the ssi method to work, but I can't seem to get it to work,do you have to do something special to the header and footer shtml files? Forgive my more than likely obvious oversite of some detail........
 
I recently had to teach myself how to do this. I found a webresource that helped allot but allas, I can no longer find that link.

You save the page where include is being used as an SHTML but the page with that is being included as a HTML. That was my big oversite the first time.

The way it works as I understand it-

You write up whatever page information (headers, footers, navbars etc...) as a html page. here, look at my page (this is an SHTML) here
That navbar is just an #include from (this is an HTML) here. If you do a view source on any of the shtml pages you will see all the code for the navbar, but all I had to put in was the include. What makes it realy cool is that if I ever want to change anything (add a new link) I can just change it once in the navbar.html file and it changes on all the pages that have the #include.

I hope that helps. I use about 4 #include commands that deal with the page formating, table formats, colors, navbar and footer of the page. Keep in mind that I am an HTML newbie, so there may be a better way to do this (like that php thing), but this works for me.
 
Last edited:
Perhaps I'm suffering from some sort of brain/occular cancer that brings forth the inner idiot like so many children's shows have in the past but despite your simple explanations I still can't get the dang blasted dealy to work.I'm on host ultra if that has any bearing on my success.
 
I dont think hostultra supports ssi. It dont say on their page. But they support php so thats you best option. Like keith said using includes. Let me try to make it as simple as posible. You make your main page index.php and inside put

PHP:
<?php
include("header.html");
?>

Plain html goes here.

<?php
include("footer.html");
?>

You put your header html in header.html and footer html in footer.html. Then in the middle just put the plain ol' html the you want to be different. Now just use this layout and do every page and save as .php .
 
Back
Top