View Full Version : /?page=pagename ?
|\|0+
05-31-2003, 02:02 AM
what is the easiest way to do websiteaddress.com/?page=pagename
?
Nightfire
05-31-2003, 02:06 AM
easiest way... least secure way...
include($_GET['page'].'.php');
|\|0+
05-31-2003, 02:15 AM
uh...how would i insert it into a page?
Nightfire
05-31-2003, 02:19 AM
url = http://somedomain.com/?page=home
That will bring up the 'home' page if you have this in a page called index.php
index.php
<?php
include($_GET['page'].'.php');
?>
of course, you'd need to create a page called home.php and upload it into the same directory
<edit>Basically, the code includes a php page that is called after the ?page=.... so if you have ?page=me, then the above code will use me.php</edit>
sleepingdanny
05-31-2003, 12:09 PM
You can also use: :thumbsup:
<?php
if($page=="home"){
print <<<html
//add here the html content
html;
}
elseif($page=="anotherpage"){
print <<<html
//add here the html content
html;
}
// ....
?>
optimism_
06-01-2003, 12:18 AM
or you could do it my outrageously complicated way, and have a database with many tables, customised XML include files and a single page that does it all :P
missing-score
06-01-2003, 10:14 PM
I actually favour database pages, but XML, nah, cant be bothered at the moment.
optimism_
06-02-2003, 06:22 PM
its act quite a cool templating engine. The database stores the url of the page, which is an XML file, compared with the ID and a Realm. The Realms have a numerial security ranking, and each user has a number too. If the user's clearance >= Realm security, they can view the page.
Meanwhile the XML files look like
<Page>
<ID>Same_as_Database</ID>
<Title>Page Title Here</Title>
<Headers><!-- additional headers here --></Headers>
<onLoad><!-- additional JavaScript onload functions --></onLoad>
<body><![CDATA[
the page goes right here:
]]></Body>
</Page>
Then the index page outputs these values as and when. I also coded a routine to look for <?xxx ?> markup tags, and execute the code dependant on the xxx language [my server has a built in KPL language]
's getting to be quite decent now, just added an Error tracking system to record all database 404s, 401s and invalid username/password errors. More added all the time :D
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.