Jump to content


Screwep up PHP Navigation


6 replies to this topic

#1 c.designs

    Young Padawan

  • Members
  • Pip
  • 128 posts

Posted 05 November 2005 - 10:14 PM

I know the entire PHP Navigation thing has been asked a lot but I didn't find the answer to my question when I searched.

I'm adding the PHP nav to my site, so the links would be appearing as http://www.cdesigns.....php?id=contact and so on...

First of all, am I right to just include it where I want it?

And here's the code I'm using... Should this work?
<?
$val = $_GET['id'];
$val .= ".php"; 
$dirty = array("..");
$clean = array("");
$val = str_replace($dirty, $clean, $val); 
if (isset($_GET['id'])) { 
if (file_exists($val)) { 
include "$val";
}
else {
include "404.shtml"; 
}
}
else {
include "index.php"; 
}

?>

The reason I'm saying it doesn't work is because on the index page (and all the other pages it's screwed up. (Note- the only pages I have right now are index, portfolio, contact).

#2 d7x

    P2L Jedi

  • Twodded Staff
  • PipPipPip
  • 586 posts
  • Gender:Male
  • Location:Virginia
  • Interests:Life

Posted 05 November 2005 - 10:42 PM

do you have the template on the other pages? you ONLY need the main template on index.php. the rest of the pages must have only text in them, not the whole layout.

#3 Squid

    Young Padawan

  • Members
  • Pip
  • 132 posts
  • Location:Netherlands
  • Interests:Webdesign, php coding, visual basic programming

Posted 06 November 2005 - 04:56 AM

d7x, on Nov 6 2005, 03:42 AM, said:

do you have the template on the other pages? you ONLY need the main template on index.php. the rest of the pages must have only text in them, not the whole layout.
Indeed, when I click the link you posted, I see you've included the template into all your pages. Like d7x said, you only need to include your template in the main index page. Then, where you want all your other pages to show up, you include the code, and only post text or other stuff in the pages, not your template. If it still doesn't work out for you, add me on msn so we can talk about it.

#4 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 06 November 2005 - 07:41 AM

all your other pages a re working except for the index page because ur a including the page with the script which include the script again etc. causing an infinite include.

#5 c.designs

    Young Padawan

  • Members
  • Pip
  • 128 posts

Posted 06 November 2005 - 10:32 AM

Do I still include the divs on the other pages?

I don't get how I would only have the template on one page, sorry.

#6 Squid

    Young Padawan

  • Members
  • Pip
  • 132 posts
  • Location:Netherlands
  • Interests:Webdesign, php coding, visual basic programming

Posted 06 November 2005 - 10:56 AM

For example, you sliced, saved and coded your website in photoshop. In the main index file, you would post your php code.

Now you have for example a menu, with a link called 'contact' in it. Make the link point to:

index.php?id=contact

In your contact page, just put the content needed to contact you. For example, your e-mail address. Now when people press the contact link, your e-mail address will appear on the site, where you put the code in. A bit hard to explain, but if you need more help, add me on msn.

#7 c.designs

    Young Padawan

  • Members
  • Pip
  • 128 posts

Posted 07 November 2005 - 03:43 PM

Ok, I understand this now. Thanks for your help. (It took awhile for it to sink it but I'm thankful)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users