
November 19th, 2004
08:46 AM
?page=webpage
Hello.
Tomorrow I will be coding two websites for personal use. Currently I have been using .shtml extensions but I want to adapt to modern day webdesign and use .php
I have seen many sites with similar links as my title. I want to know how to implent this sort of system into my own website? My friend says its a "content includer". How exactly do I get this to work?
Thanks.

November 19th, 2004
08:55 AM
<?
if(!$_GET[page]) { // If page is not set
$page = "main.php"; // set $page to main.php
}
else { // if page is set
if($_GET[page] == "index" || $_GET[page] == "index.php") { header("Location: index.php?page="); }
if(file_exists($_GET[page])) { // if the file $page exists
if (eregi('.php', $_GET[page])) { // if the var $_GET[page] already contains .php
include($_GET[page]); // include $_GET[page]
}
else { // if the page doesn't have .php already
$page = $_GET[page].".php"; // add .php to $_GET[page]
include($page); // And include the new $page var
}
}
else { // if $_GET[page] doesn't exist
// include("error404.php"); // You might want to use this
die("The page $page cannot be found"); // die and give an error
}
}
?>
Where main.php is the default page.
Last edited by PuzZah, November 20th, 2004 12:21 AM (Edited 1 times)

November 19th, 2004
09:04 AM
This doesn't mean much to me as I haven't done any PHP before? :confused:

November 19th, 2004
09:04 AM
Neversidian
Status: Offline!
http://www.stphp.com/?id=tuts/72484741
___________________
STphp - Modern Web Solutions - CLOSED
ShaunTobias.co.uk - Blog and Portfolio - CLOSED
Look out for LookCreative.co.uk in September.

November 19th, 2004
10:08 AM
23, mother, art slave, code monkey
Status: Offline!
http://www.aesthetic-theory.com/learn.php?query
___________________
And the sig ran away with the spoon.

November 19th, 2004
10:54 AM
whoa, wtf?
Status: Offline!
Good god people, there are like 5 threads on this subject alone on this page. Search please.
___________________
Fomerly known as lasnaranjas. Holler.


November 19th, 2004
06:00 PM
Originally posted by lasnaranjas
Good god people, there are like 5 threads on this subject alone on this page. Search please.
Seeing as I didn't know what I was exactly looking for how could I search? Go troll somewhere else.
Thanks to the people who actually helped. 

November 19th, 2004
09:48 PM
thinking of something witty to put here
Status: Offline!
Originally posted by Stompy
Seeing as I didn't know what I was exactly looking for how could I search? Go troll somewhere else.
It is the first resource in the sticky.
http://tutorialforums.com/showthread.php?s=&threadid=16851

November 20th, 2004
06:50 PM
Neversidian
Status: Offline!
or you could go by the title of the sticky thread "(READ 1ST, POST 2ND)"
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

November 20th, 2004
09:03 PM