Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I m creating the php website which have index.php. index include the header, leftnav, footer.php. i want the contents on the header or leftnav to display in an index.php when i click on the hyperlink.
please show me how to do it or give me some code or the good php tutorial websitethank you

I'm not sure I'm understanding your question. I *think* you are saying that you have separate files for the nav, header and footer and want to include those in the index file. You can include other files using the include command.

here's a user-friendly tutorial about include() and templating:

thank for your quick reply...
my problem is not the include(). i already include those 3 file in index. now i have to work with the link. I don't know how to make the hyperlink work on PHP. for example. i have the button call "about us" when you click on that button,,,it information about us will show up in the wiew area and the header, leftnav, footer still reamain unchange.
i don't know if i clear enough...

Sorry, no you are not clear. When you click on the "About Us" link what are you wanting to happen on that page that is not happening now? Also, please try to use correct terminology when possible: "I don't know how to make the hyperlink work on PHP" makes no sense. Hyperlinks are still HTML, PHP is used to create the HTML. There is no such thing as a PHP link.

Maybe I get it :D
PHP include() is not the same with frames. By using includes, even if you include a lot of files, the output is still a single HTML file.
when you click on that button,,,it information about us will show up in the wiew area and the header, leftnav, footer still reamain unchange.
Let's say this is the content of index.php:
<?php
include ("header.php");
include ("menu.php");if ($_GET['page'] == 'about-us')
{include ("about-us.php");
}
else
{
include ("home.php");
}
include ("footer.php");
?>
That way, when you call index.php, the "content" in home.php will shows up. But if you do index.php?page=about-us then about-us.php will shows up.header, menu, and footer.php will remain the same.
That tutorial link above is actually telling about this, about how to make the header, menu, footer.php, and "content files", to not ruin the HTML structure.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |