If *url exists*, then show this code...
Posted: Wed May 12, 2010 10:33 am
Hi there,
My problem is quite simple, but I can't figure out how to word it into a simple search term, so I am asking here.
I want to use a php include for a website. The include contains the navigation for the site, which follows this format:
<ul id="nav">
<li><a href="home.php" class="active">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
What I'm trying to do is define the active state of the particular navigation item for each page. So in pseudo-code speak, I want this to happen:
If the URL is equal to "www.mysite.com/about.php", then show "class="active" in the link for the "About" navigation item.
I know how to do this using ExpressionEngine, by writing:
{if segment_1 == "about.php"} class="active" {/if}
So how do I do it using straight PHP? Thanks for the help! Snarky comments aren't needed, so don't bother plzthx.
My problem is quite simple, but I can't figure out how to word it into a simple search term, so I am asking here.
I want to use a php include for a website. The include contains the navigation for the site, which follows this format:
<ul id="nav">
<li><a href="home.php" class="active">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
What I'm trying to do is define the active state of the particular navigation item for each page. So in pseudo-code speak, I want this to happen:
If the URL is equal to "www.mysite.com/about.php", then show "class="active" in the link for the "About" navigation item.
I know how to do this using ExpressionEngine, by writing:
{if segment_1 == "about.php"} class="active" {/if}
So how do I do it using straight PHP? Thanks for the help! Snarky comments aren't needed, so don't bother plzthx.