Jump to content

Lf Input On Different Ways To Display Dynamic Content


renfley

Recommended Posts

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

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");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.