renfley Posted October 5, 2012 Share Posted October 5, 2012 Hey guys this has been asked before and i was wondering what technics you guys use for displaying dynamic content. Basicly when a link is clicked it would send you to www.explample.com/?page=new How would i check in php and display the page with that article. if issset() page $name{ include ('includes/$name' . '.php') else echo page does not exist Ya i know shoot me for the most horrible example but im doing this from my iphone right now !! Any help greatly apreciated Quote Link to comment https://forums.phpfreaks.com/topic/269138-lf-input-on-different-ways-to-display-dynamic-content/ Share on other sites More sharing options...
Christian F. Posted October 5, 2012 Share Posted October 5, 2012 This is more of an "Application Design" question, as you don't have any actual PHP code that you're having problems with getting to work. To give you an short answer. For include scripts, this is what I do: // Validates the page navigation passed. $page = ($Page = substr (strtolower (preg_replace ('([^a-zA-Z])', '', $_GET["page"])), 0, 20)) ? $page : "index"; // Check if PHP-source file exists. if (!is_file ("php/{$page}.php")) { // Could not find the file, show 404 error. trigger_error ("{10404} $page", E_USER_ERROR); } // Check if script can read the file if (!is_readable ("php/{$page}.php")) { // Couldn't, show 404 error. trigger_error ("{10404} $page", E_USER_ERROR); } // File exists and can be read, include. include ("php/{$page}.php"); Quote Link to comment https://forums.phpfreaks.com/topic/269138-lf-input-on-different-ways-to-display-dynamic-content/#findComment-1383094 Share on other sites More sharing options...
renfley Posted October 9, 2012 Author Share Posted October 9, 2012 Awesome thanks for the reply i will test this out and see how she works anyone else have a well kept dynamic secret there willing to share? Quote Link to comment https://forums.phpfreaks.com/topic/269138-lf-input-on-different-ways-to-display-dynamic-content/#findComment-1383993 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.