imawake Posted February 19, 2008 Share Posted February 19, 2008 Hi, I have a file called content.php which contains the following code: <?php // if it isn't a main section get the homepage if ($subDir == null) { include ($_SERVER['DOCUMENT_ROOT'] . '/dev/includes/content_pages/home/home.php'); } // or if the url is a main section, get that main section if ($subDir != null && $childDir == null) { include ($_SERVER['DOCUMENT_ROOT'] . '/dev/includes/content_pages/' . $subDir . '/' . $subDir . '.php'); } // If the url is a subpage of the main section get that content if ($subDir != null && $childDir != null) { include ($_SERVER['DOCUMENT_ROOT'] . '/dev/includes/content_pages/' . $subDir . '/' . $pageTitle . '.php'); } ?> The problem I'm having is that I need my subpages to be displayed if I go to those subpages. At the moment, I'm seeing the homepage when I try to load a subpage like products.php. I'm new to php and if anyone can offer suggestions, I would greatly appreciate the help. If you need more detail, please let me know. Thanks Quote Link to comment Share on other sites More sharing options...
schilly Posted February 19, 2008 Share Posted February 19, 2008 Did you define $subDir and $childDir somewhere? Quote Link to comment Share on other sites More sharing options...
imawake Posted February 19, 2008 Author Share Posted February 19, 2008 Not that I can see. It's not my code. I'm updating an older site. Quote Link to comment Share on other sites More sharing options...
schilly Posted February 20, 2008 Share Posted February 20, 2008 Are they being passed in somewhere? $_GET variables? // If the url is a subpage of the main section get that content if ($subDir != null && $childDir != null) { include ($_SERVER['DOCUMENT_ROOT'] . '/dev/includes/content_pages/' . $subDir . '/' . $pageTitle . '.php'); } I think $childDir should be $pageTitle. Looks like the variables aren't defined so it always defaults to the first option which is the home page. You could try to echo them and see if they are set or not or use isset on them. Quote Link to comment 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.