Jump to content


PHP Navi Looking For Files... Not Cat.


4 replies to this topic

#1 Pbkilldezines

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 17 January 2005 - 08:25 PM

Ok I have a php nav system. My tutorials link goes like this: index.php?page=tutorials.php

but when the tutorial page loads, I get this problem when I try to click on a catagory.

index.php?page=show_catagory.php=Photoshop:
and i get this error:

Warning: main(show_catagory.php=Photoshop): failed to open stream: No such file or directory in ******/*****/********/****index.php on line 160

Warning: main(show_catagory.php=Photoshop): failed to open stream: No such file or directory in *****/*******/*****/index.php on line 160

Warning: main(): Failed opening 'show_catagory.php=Photoshop' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in*****/*******/*****/index.php on line 160

(all the files are in the right directory)

The way the show page works: it gets the catagory like a PHP nav system works and then connects to the DB and gets the info.

If you need me to post any code just tell me:

PLEASE HELP.
Thanks!


edit:
( o yeah, heres the code I have in the index.php )

<?
$page = $_GET['page'];
if (strpos($_GET['page'], "http://") !== false) {
echo "This url contains http://!";
} else {
include "$page";
}
?>

#2 Pbkilldezines

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 17 January 2005 - 10:00 PM

Is there anyone on this forum who can acually help me please?

#3 Tsixm

    Young Padawan

  • Members
  • Pip
  • 28 posts

Posted 18 January 2005 - 08:47 PM

Quote

index.php?page=show_catagory.php=Photoshop

;)

The equal sign will interfere with the include. That and you need a ? and a var in order for PHP to know what the heck you want it to do. Unless there's something you want to share with us...

#4 rc69

    PHP Master PD

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

Posted 19 January 2005 - 10:45 AM

the problem is with the "=", but you don't need another "?" to make it work, you need a new variable and an "&"
i.e. instead of: index.php?page=show_catagory.php=Photoshop
use: index.php?page=show_catagory.php&cat=Photoshop

then add a "$_GET['cat']" var some where so your script knows which category to include

use the same sorta think on my site for tutorials... check it out if you want

#5 Tsixm

    Young Padawan

  • Members
  • Pip
  • 28 posts

Posted 19 January 2005 - 01:36 PM

<?
$page = $_GET['page'];
$extention = $_GET['extention'];
if (strpos($_GET['page'], "http://") !== false) {
echo "This url contains http://!";
} else {
$npage = $page."?category=".$extention;
include "$npage";
}
?>

I have no idea if that will work, but you would need to set it up like:

http://yoursite.com/index.php?page=tutorials.php&extention=photoshop

Hope that helps





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users