View Full Version : Change Page Content
mark87
04-20-2005, 03:13 PM
Totally new to PHP, just wondering how you would change the page content depending on URL - eg. index.php?page=home etc - then echo the html to the page so it is displayed. Is there a way to pull the source from another file for each page as well?
Fou-Lu
04-20-2005, 03:49 PM
You are referring to the querystring:
http://www.site.com/index.php?do=whatever&id=number
To use:
if ($_REQUEST['do'] == 'whatever')
{
// Do stuff here for 'whatever' being there
}
Of course, you need to create a default for !isset on your request, otherwise you will get notices. And yes, you can pull external information using include for php files, and I believe its virtual for others.
NancyJ
04-20-2005, 04:18 PM
$page = $_GET['page'];
switch($page)
{
case 'home':
include 'home.html';
break;
case 'news':
include 'news.html';
break;
case 'page3':
include 'page3.html';
break;
default:
include 'home.html';
break;
} ;
mark87
04-20-2005, 04:36 PM
Thanks! :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.