View Full Version : back in business
ColdArmor
10-2-05, 12:37 PM
I use to be a coder a few years back, and I'm getting into it again.. but I forgot how to use php for something like this:
index.php?page=something
can someone give me the sample code for that to refresh my memory? thanks a million
ibrudiiv
10-2-05, 12:38 PM
To get the value of page you do:
$var = $_GET['page'];
ColdArmor
10-2-05, 01:18 PM
I want to set it up like where I want the content to display so like
/about/me/cold.html = index.php?page=aboutcold
ibrudiiv
10-2-05, 03:13 PM
Oh I see what you mean now. Do this:
if ($_GET['page'] == "aboutcold")
{
include 'about/me/cold.html';
}
mitchind
10-2-05, 05:42 PM
If I read you right, I think you're talking about using .htaccess file .
Check that forum out - there's a lots of previous examples.
ibrudiiv
10-2-05, 06:20 PM
According to what he has been posting, he wants pages to display a web page based on the Querystring value of "page." He's gonna have to have an index page (index.php, for example) and put that code in there. The code can also be customized to include many more pages.
As such:
if ($_GET['page'] == "aboutcold")
{
include 'about/me/cold.html';
}
elseif ($_GET['page'] == "page2")
{
include 'page2.html';
}
elseif ($_GET['page'] == "page3")
{
include 'page3.html';
}
elseif ($_GET['page'] == "page4")
{
include 'page4.html';
}
Where he would put the content of a certain page he would instead put that code. This also works great when you have a navigation menu so you only have to change one page (that holds the menu) and it affects all pages that have the include code for the navigation page.
vBulletin v3.6.0, Copyright ©2000-2010, Jelsoft Enterprises Ltd.