Jump to content

Change Content With Php


don2000
 Share

Recommended Posts

Guest FirefoxRocks

What do you mean by hardcoded headers and footers? And yes you can using PHP changable content in your headers and footers. They are PHP pages after all.

Link to comment
Share on other sites

Think he means something like

include("header.php");include($page);include("footer.php");

Link to comment
Share on other sites

Yes, that's what I want to do but $page won't work. I can define $page to be page1 and it will show page1, the address bar will change to page2 when I click the page2 link, but the content doesn't change. Currently each page simply has Header 1, 2, 3, etc within HTML h1 tags.

Link to comment
Share on other sites

Do two tests (you can do them at the same time):1) Echo a var_dump of $page on the page2) Make the page it has to include echo a simple "Page 1", "Page 2", etc.This way, you can easily see where things go wrong: It can be that $page doesn't get an acceptable value, could be that something's wrong in the different pages' code, or, as FirefoxRocks said, could be that your pages' contents is the same. Could also be that there's something wrong in the way it includes the pages. The two tests described above will help you see where the error is.

Link to comment
Share on other sites

you have to include the php page file name as stated, then the content in that page must be set within a function like:function showheader(){header php and html content}function showfooter(){footer php and html content}then within the area you wish this content to be displayed type<?phpshowheader();?>bottom of page, same again<?phpshowfooter();?>I have used this method before, and reduced a 20+ page website, to 1 to 3 page, but producing the same content and display.

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...