PHP Navigation

Hello,

I am creating a website. The layout of my website is something like this:
header is on the top, sidebar and content area are in the middle and footer at the end.

Now, when I want my website to display pages in the content area when any link in the sidebar is or header is clicked. How can I do this using PHP?
krutarth941Asked:
Who is Participating?
 
Lukasz ChmielewskiCommented:
You can have index.php file with the code:

<?php
 // header menu
?>
<a href="index.php?page=main">main</a>
<a href="index.php?page=somepage">somepage</a>
<?php
 if(!empty($_GET[page])){
   include($_GET[page].".php");
 }
?>

Open in new window


And two files: main.php and somepage.php, clicking the links includes the content
0
 
scifo_dkCommented:
I usually load a whole new page.

If you just split the site up in parts like a header, sidebar and footer, and then include them in the area they should be, then you only have a raw page file, with the other files included.

If you really wan't to only load the content area, you can insert an iframe in that area, set its name = iframe, and then user target=ifram in your links.
0
 
krutarth941Author Commented:
I don't want to use iframes.  The reason for that is it restricts search engine capability of the site. Is there any way to load only the content section in php?
0
 
scifo_dkCommented:
Yes, if you use jQuery and Ajax. This video shows you how it works:
http://www.youtube.com/watch?v=0CMTQtnZ0G0
0
 
krutarth941Author Commented:
The link was helpful. Thank you very much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.