Darkstasis Posted December 23, 2008 Share Posted December 23, 2008 I got help before with adding in page arrays. I'm using an example that I was given to learn. Basically, I have index.php and 3 pages of content. I add in the array and 3 links to toggle between pages with index.php showing no content pages already. This has worked fine, but now I'd like to know how I can get news.php as a default when index.php loads? $page_mapping = array( 'page1' => 'content/page1content.php', 'page2' => 'content/page2content.php', 'news' => 'content/news.php', ); $page = $_REQUEST['page']; if (!empty($page_mapping[$page])) { include_once($page_mapping[$page]); } Link to comment https://forums.phpfreaks.com/topic/138114-solved-small-page-mapping-array-question-default-page/ Share on other sites More sharing options...
trq Posted December 23, 2008 Share Posted December 23, 2008 $page_mapping = array( 'page1' => 'content/page1content.php', 'page2' => 'content/page2content.php', 'news' => 'content/news.php', ); $page = $_REQUEST['page']; if (!empty($page_mapping[$page])) { include_once($page_mapping[$page]); } else { include_once "index.php"; } Link to comment https://forums.phpfreaks.com/topic/138114-solved-small-page-mapping-array-question-default-page/#findComment-722005 Share on other sites More sharing options...
Darkstasis Posted December 23, 2008 Author Share Posted December 23, 2008 Heh, It figures. I thought it'd be much more simple than I thought. Thank you Thorpe Link to comment https://forums.phpfreaks.com/topic/138114-solved-small-page-mapping-array-question-default-page/#findComment-722013 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.