erme Posted October 26, 2011 Share Posted October 26, 2011 Hi, I'm basically trying to write something like the below: $uri = "1"; $uri = "2"; if ($uri == "1") { echo 'test 1'; } if ($uri == "2") { echo 'test 2'; } if ($uri == "3") { echo 'test 3'; } I will define $uri on every page and I want the php to process what to display on the page, ie test 1, test 2 and/or test 3 Quote Link to comment https://forums.phpfreaks.com/topic/249863-selection-for-page/ Share on other sites More sharing options...
requinix Posted October 26, 2011 Share Posted October 26, 2011 Strictly answering the question, $uri = "1"; include "showpage.php"; if ($uri == "1") { echo 'test 1'; } // ... There are better ways of doing this, and I don't just mean using switches instead of if blocks. Quote Link to comment https://forums.phpfreaks.com/topic/249863-selection-for-page/#findComment-1282514 Share on other sites More sharing options...
erme Posted October 27, 2011 Author Share Posted October 27, 2011 Yea I got that bit working, but what I need is to be able to declair more then one .. for say page x wanted to show 1, 2 and 3, page y wanted to show only 1 and 3 Quote Link to comment https://forums.phpfreaks.com/topic/249863-selection-for-page/#findComment-1282605 Share on other sites More sharing options...
requinix Posted October 28, 2011 Share Posted October 28, 2011 Put all those echos into separate files and include them directly whenever you want them. Forget the $uri stuff. include "page1.php"; include "page2.php"; include "page3.php"; include "page1.php"; include "page3.php"; Quote Link to comment https://forums.phpfreaks.com/topic/249863-selection-for-page/#findComment-1283113 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.