Jump to content


Photo

ID Linking


  • Please log in to reply
2 replies to this topic

#1 Bavilo

Bavilo
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 15 March 2006 - 01:40 AM

Ok,

I am really frustrated right now...This has been going on for several weeks now and i just cannot find an answer. I have one index.php where i have the following code

<?
        $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 "id/404.php";
               }
       }
          else {
                include "id/start.php";
       }
    ?>

I use this to navigate from page to page without having to make a complete new page for everything. So this basically just includes another page with the php extension into my main div. This works great for pages that do nothing but hold content. But it will not work if i try to link to a gallery or slideshow, or whatever, that has to include other pages. Once i include for example gallery.php, the gallery.php is now part of my index.php in the main div. It has no way of including all the other pages as its in the wrong directory. And i can't just go into the gallery.php and change every single link because it doesn't seem to work in this format. index.php?id=id/gallery/ I dont know what to do. How does everybody else pull this off??

Thanks in advance
Mike

#2 Bavilo

Bavilo
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 15 March 2006 - 02:24 AM

Anyone? Please?

#3 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 15 March 2006 - 02:32 AM

In your included files, for example gallery.php, make sure that you have the full path to the file to be included from gallery.php. Meaning use:

include("/includes/somefile.php");

not just:

include("includes/somefile.php");

You shouldn't have to put the full path to the file from the file system (/usr/username/... or c:\www\files\includes...) just from the document root should be fine.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users