Jump to content


change php include with a link


2 replies to this topic

#1 RustyNail

    Young Padawan

  • Members
  • Pip
  • 39 posts
  • Location:in my room

Posted 10 September 2005 - 08:45 PM

I want to have a php include on my site so that when a link for another page is clicked nothing but the php included part changes. Sort of the way a frame would work. i would use an Iframe but I've been given the impression that frames are evil.

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 10 September 2005 - 08:59 PM

http://www.pixel2life.com/tutorials/PHP_Co..._and_Templates/
http://www.pixel2lif...showtopic=10668
http://www.pixel2lif...?showtopic=8530

Next time please do a little bit of searching, or explain your problem better. Because i have honestly no idea what you need help with

p.s. Moved to proper category (a category that i know you know of...).

#3 danbair

    Young Padawan

  • Members
  • Pip
  • 8 posts
  • Location:Bothell, Washington

Posted 20 September 2005 - 05:30 AM

I think I know what you mean: PHP Navigation.

The wait I do it is I have two pages that have PHP coding on them, the first is the index.php, where I have my non-changing template, and I put in the code:

<?php
include('navigation.php');
?>

Then on navigation.php I put:
<?php
switch($section) {
default:
include('home.php');

break; case "about":
include('about.php');

break; case "contact":
include('contact.php');

}
?>

so your links would change to:
www.something.com/index.php?section=default
www.something.com/index.php?section=about
www.something.com/index.php?section=contact

Hope this answers your question.

Edited by danbair, 20 September 2005 - 05:30 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users