Jump to content


This topic is now archived and is closed to further replies.


ID Linking

Recommended Posts


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

Share this post

Link to post
Share on other sites
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:


not just:


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.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.