Forum Moderators: coopster
<?
$NavLocation='Home';
if ($NavLocation == 'Home') {
?> class='foo' <?
} else {
?> class='foo1' <?
}
?>
Here's a link to the page in documentation that covers this:
PHP Control Structures [us2.php.net]
-=casey=-
This would be on top of home.asp
<% NavLocation="home" %>
This would be on top of inner1.asp
<% NavLocation="inner1" %>
-------------------------------------------
These are in my header include.....
<If NavLocation ="home" then %>class="foo"<% else %>class="foo1"<% end if %>
<If NavLocation ="inner1" then %>class="foo"<% else %>class="foo1"<% end if %>
I almost have it for php but I dont know how to specify which page to make the statment? I have this on top of my inner1 page :
<? $NavLocation='Inner1'?>
But, I dont want it on the home page...anyone have a clue what I'm talking about?
At the top of home page you will want:
<? $NavLocation = 'home';?>
At the top of the inner page you will want:
<? $NavLocation = 'Inner1';?>
and so on.
Your include will be after that variable is set.
If you do not want to have the tag at the top of the home page or if you want the home item to be highlighted by default, you should add the following bolded text to the If Statement for the home. It will catch instances where $NavLocation is not set or has been set to an empty string.
<?
if (($NavLocation == 'home') ¦¦ (empty($NavLocation)) ¦¦ (isset($NavLocation))){
?>class='foo'<?
}else{
?>class='foo1'<?
}
?>
-=casey=-
this is asp:
<% NavLocation="home" %> (goes with page home.asp)
<If NavLocation ="home" then %>class="foo"<% else %>class="foo1"<% end if %>
-----------------------------------------
this is the exact same thing in php:
<? $NavLocation='Home'; if ($NavLocation == 'Home')?> (goes with page home.php)
<? if ($NavLocation == 'Home') {?>class="foo"<? } else {?>class="foo1"<? }?>
I really think asp is an easier language to understand and write, but thats my bias opinion. I'm used to it.
-ryan