Bavilo Posted March 15, 2006 Share Posted March 15, 2006 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[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"; } ?>[/code]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 advanceMike Quote Link to comment https://forums.phpfreaks.com/topic/4994-id-linking/ Share on other sites More sharing options...
Bavilo Posted March 15, 2006 Author Share Posted March 15, 2006 Anyone? Please? Quote Link to comment https://forums.phpfreaks.com/topic/4994-id-linking/#findComment-17654 Share on other sites More sharing options...
hitman6003 Posted March 15, 2006 Share Posted March 15, 2006 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:[code]include("/includes/somefile.php");[/code]not just:[code]include("includes/somefile.php");[/code]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. Quote Link to comment https://forums.phpfreaks.com/topic/4994-id-linking/#findComment-17656 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.