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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.