ev5unleash Posted May 28, 2008 Share Posted May 28, 2008 I was looking at php sites, for example as I post this and look at the address bar. I want to know how to have one Php file and add muliple page into it so if I wanted to show news it would look something like index.php?show=news. I'm new to PHP but I was wondering if anyone could help me out. Quote Link to comment https://forums.phpfreaks.com/topic/107550-1-php-file-for-multiple-sets-of-information/ Share on other sites More sharing options...
dezkit Posted May 28, 2008 Share Posted May 28, 2008 <?php $page = $_GET["page"]; if (!$page) { include "/home.php"; } else if($page=="Home") { include "/home.php"; } //index.php?page=Home is really Home.php else if($page=="Forum") { include "/forum.php"; } //index.php?page=forum is really forum.php else { echo "<b><h1>404 Error</h1></b>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/107550-1-php-file-for-multiple-sets-of-information/#findComment-551334 Share on other sites More sharing options...
ev5unleash Posted May 28, 2008 Author Share Posted May 28, 2008 I keep getting error messages with the regular file and it won't view when i put it the info.php?page=welcome.html Warning: include(/welcome.html) [function.include]: failed to open stream: No such file or directory in /var/www/homepage/info.php on line 5 Warning: include() [function.include]: Failed opening '/welcome.html' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/homepage/info.php on line 5 With the URL http://www1.ev5unleash.com:1212/homepage/info.php?page=welcome Quote Link to comment https://forums.phpfreaks.com/topic/107550-1-php-file-for-multiple-sets-of-information/#findComment-551500 Share on other sites More sharing options...
haku Posted May 28, 2008 Share Posted May 28, 2008 That error means that the path to the file to be included is incorrect. Check the path, figure out where you have gone wrong. Quote Link to comment https://forums.phpfreaks.com/topic/107550-1-php-file-for-multiple-sets-of-information/#findComment-551547 Share on other sites More sharing options...
ev5unleash Posted May 28, 2008 Author Share Posted May 28, 2008 Thanks, I'm all fixed up. One of my friend's helped me out. Quote Link to comment https://forums.phpfreaks.com/topic/107550-1-php-file-for-multiple-sets-of-information/#findComment-552107 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.