Steve Fitzgerald <sf@mnetsys.com> wrote:
This should be so easy, but it is not working.
What should happen is that if $p=home in the url then it displays
home.php and if $p does not equal home then it displays page.php which
is a template.
What am I missing?
<?php
// display page
if (@$p == $_GET['home']){
$p is actually empty here. If $_GET['home'] is also empty the above
statement would be true.
include ('pages/home.php');
} elseif (@$p != $_GET['home']){
As $p is always empty, the above would be true if $_GET['home'] is not
empty.
If I understood you correctly, you have a parameter called 'p' in your URL
which sometimes is set to "home", sometimes not.
So you would check:
if (isset($_GET['p']) && $_GET['p']=="home"){
include ('pages/home.php');
} elseif (isset($_GET['p']) && $_GET['p']!="home"){
include ('pages/page.php');
}else{
include ('pages/home.php');
}
HTH;
JOn