View Full Version : how to do PHP pages

08-12-2002, 04:05 AM
i was wondering..does anyone know how exactly to get pages to come up with like "http://www.server.com/pages.php?id=hosting ? what are the exact steps in making that able to happen? i know u gotta make like hosting.php so when its called like that it works..but i need the exact steps

08-12-2002, 04:35 AM
Link to it like that, and use the variable $id and an if-then-else statement to display different things with different ids.

if ($id == hosting){ echo "InsertStuffHere"
else if ($id == quack){ echo "MrQuakers was here"

08-12-2002, 01:11 PM
If you want id=hosting to reference hosting.php and build the main page to include that subfile...

if($_POST) {extract($_POST);}
$basepath = '/usr/home/dommy/includes/';
if(!isset($id) || $id=="") {$id = 'default';}

if(file_exists($basepath.$id.'.php')) {

else {
echo 'Requested page could not be found';

Which basically tests whether the variable $id exists (if it doesn't, the script assigns it a value of 'default'), tests whether a file exists in the dictated folder with the name $idvalue.php and if that file exists it includes it in the main page.
That system is most useful for templates where the head, title and main page look are static.

08-12-2002, 02:43 PM
Have a look on alistapart (http://www.alistapart.com/) as they've put up an article recently which may give you some pointers to the what you're trying to do.


08-12-2002, 09:38 PM
ok thanks for the help guys!