<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Faux Active Link</title>
	<atom:link href="http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/</link>
	<description>Hypertext rulez™</description>
	<pubDate>Thu, 28 Aug 2008 20:24:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: PaulC</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-825</link>
		<dc:creator>PaulC</dc:creator>
		<pubDate>Thu, 28 Jul 2005 13:08:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-825</guid>
		<description>Couldnt you do this just by re-defining the body tag?

eg. you have these styles:
&lt;i&gt;
li, li a {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #333333;
	font-size: 10px;
	text-decoration: none;
}
body.home li .home, body.about li a.about, body.products li a.products{
	color: #FF0000;
	text-decoration: underline;
	font-weight: bold;
}&lt;/i&gt;

the you change the body tag to any of the following &lt;i&gt;&#60;body class="about"&#62;  or &#60;body class="home"&#62;&lt;/i&gt; etc. etc.

Then you list items / menu is as follows:
&lt;i&gt;&#60;ul&#62;&lt;br /&gt;
&#60;li&#62;&#60;a href=&#34;index.php&#34; class=&#34;home&#34;&#62;home&#60;/a&#62;&#60;/li&#62;&lt;br /&gt;
&#60;li&#62;&#60;a href=&#34;about.php&#34; class=&#34;about&#34;&#62;about&#60;/a&#62;&#60;/li&#62;&lt;br /&gt;
&#60;li&#62;&#60;a href=&#34;products.php&#34; class=&#34;products&#34;&#62;products&#60;/a&#62; ,&#38;lt; &#38;gt; &#60;/li&#62;&lt;br /&gt;
&#60;/ul&#62;&lt;/i&gt;

Just a crazy idea..  :)

see also &lt;a href="http://www.apple-source.co.uk/"&gt;http://www.apple-source.co.uk/&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Couldnt you do this just by re-defining the body tag?</p>
<p>eg. you have these styles:<br />
<i><br />
li, li a {<br />
	font-family: Verdana, Arial, Helvetica, sans-serif;<br />
	color: #333333;<br />
	font-size: 10px;<br />
	text-decoration: none;<br />
}<br />
body.home li .home, body.about li a.about, body.products li a.products{<br />
	color: #FF0000;<br />
	text-decoration: underline;<br />
	font-weight: bold;<br />
}</i></p>
<p>the you change the body tag to any of the following <i>&lt;body class=&#8221;about&#8221;&gt;  or &lt;body class=&#8221;home&#8221;&gt;</i> etc. etc.</p>
<p>Then you list items / menu is as follows:<br />
<i>&lt;ul&gt;<br />
&lt;li&gt;&lt;a href=&quot;index.php&quot; class=&quot;home&quot;&gt;home&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&quot;about.php&quot; class=&quot;about&quot;&gt;about&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&quot;products.php&quot; class=&quot;products&quot;&gt;products&lt;/a&gt; ,&amp;lt; &amp;gt; &lt;/li&gt;<br />
&lt;/ul&gt;</i></p>
<p>Just a crazy idea..  :)</p>
<p>see also <a href="http://www.apple-source.co.uk/">http://www.apple-source.co.uk/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin Perkins</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-239</link>
		<dc:creator>Justin Perkins</dc:creator>
		<pubDate>Fri, 04 Feb 2005 08:41:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-239</guid>
		<description>Just wanted to point out the Server Variables are always full of good information, like the REQUEST_URI.

Nobody has talked about ASP since the beginning, maybe since it is so old school. Try using

Request.ServerVariables("SCRIPT_NAME")</description>
		<content:encoded><![CDATA[<p>Just wanted to point out the Server Variables are always full of good information, like the REQUEST_URI.</p>
<p>Nobody has talked about ASP since the beginning, maybe since it is so old school. Try using</p>
<p>Request.ServerVariables(&#8221;SCRIPT_NAME&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marko</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-229</link>
		<dc:creator>marko</dc:creator>
		<pubDate>Sun, 16 Jan 2005 11:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-229</guid>
		<description>Ryan,

Let&#8217;s stay on topic here. The logic for the last scenario is pretty much the same. You just need &lt;a href="http://www.php.net/manual/en/function.split.php"&gt;some function&lt;/a&gt; to split the string &lt;code&gt;REQUEST_URI&lt;/code&gt; and place the substrings in an array. Something like:
&lt;code&gt;&#60;?php
list($directory, $subdirectory) = split('/', $_SERVER["REQUEST_URI"]);
echo '&#60;div class="' . $directory . ' id="' . $subdirectory . '"&gt;';
?&gt;&lt;/code&gt;
I have no time to test it, but it&#8217;s a good start for you to dive into it.

Yes, the &lt;a href="http://www.maratz.com/blog/archives/2004/08/21/comment-form-preview-script/"&gt;comment form preview script&lt;/a&gt; have been explained and there is also a full &lt;a href="http://www.maratz.com/blog/archives/category/codingdesign/"&gt;list of posts about coding&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Ryan,</p>
<p>Let&#8217;s stay on topic here. The logic for the last scenario is pretty much the same. You just need <a href="http://www.php.net/manual/en/function.split.php">some function</a> to split the string <code>REQUEST_URI</code> and place the substrings in an array. Something like:<br />
<code>&#60;?php<br />
list($directory, $subdirectory) = split('/', $_SERVER["REQUEST_URI"]);<br />
echo &#8216;&#60;div class=&#8221;&#8216; . $directory . &#8216; id=&#8221;&#8216; . $subdirectory . &#8216;&#8221;>&#8217;;<br />
?></code><br />
I have no time to test it, but it&#8217;s a good start for you to dive into it.</p>
<p>Yes, the <a href="http://www.maratz.com/blog/archives/2004/08/21/comment-form-preview-script/">comment form preview script</a> have been explained and there is also a full <a href="http://www.maratz.com/blog/archives/category/codingdesign/">list of posts about coding</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryan</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-227</link>
		<dc:creator>ryan</dc:creator>
		<pubDate>Sat, 15 Jan 2005 23:01:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-227</guid>
		<description>I have one more question if you have time. By the way I'm a beginner at php. :) 

This works with this url ....com/rideshare/:
&lt;code&gt;&#60;?php if ($_SERVER["REQUEST_URI"] == '/rideshare/') { echo 'ridesharetitle'; } else { echo 'hometitle'; } ?&#62;&lt;/code&gt;

Within the /rideshare/ folder  I have dynamic premalinks gernerated by WP.
ex: ....com/rideshare/&lt;strong&gt;this-title/&lt;/strong&gt;

How can I get the code
&lt;code&gt;&#60;?php if ($_SERVER["REQUEST_URI"] == '/rideshare/') { echo 'ridesharetitle'; } else { echo 'hometitle'; } ?&#62;&lt;/code&gt;
to include all the dynamic directories under the /rideshare/ directory? Hence, directories such as  &lt;em&gt;....com/rideshare/this-title/&lt;/em&gt; or &lt;em&gt;....com/rideshare/generated-title/&lt;/em&gt; or &lt;em&gt;....com/rideshare/could-be-anything/&lt;/em&gt;

Site in development is here:
&lt;a href="http://www.panictour.com/rideshare/" title="Site in question."&gt;http://www.panictour.com/rideshare/&lt;/a&gt;

Postscript:
Have you ever released your "preview comment" code? I know hicks  has his version but your seems alot nicer.  I'd like to get ahold of yours if you don't mind. By the way your site is very clean and professional.  I like it! 

Thanks again  for the help.

-Ryan</description>
		<content:encoded><![CDATA[<p>I have one more question if you have time. By the way I&#8217;m a beginner at php. :) </p>
<p>This works with this url &#8230;.com/rideshare/:<br />
<code>&#60;?php if ($_SERVER["REQUEST_URI"] == &#8216;/rideshare/&#8217;) { echo &#8216;ridesharetitle&#8217;; } else { echo &#8216;hometitle&#8217;; } ?&#62;</code></p>
<p>Within the /rideshare/ folder  I have dynamic premalinks gernerated by WP.<br />
ex: &#8230;.com/rideshare/<strong>this-title/</strong></p>
<p>How can I get the code<br />
<code>&#60;?php if ($_SERVER["REQUEST_URI"] == &#8216;/rideshare/&#8217;) { echo &#8216;ridesharetitle&#8217;; } else { echo &#8216;hometitle&#8217;; } ?&#62;</code><br />
to include all the dynamic directories under the /rideshare/ directory? Hence, directories such as  <em>&#8230;.com/rideshare/this-title/</em> or <em>&#8230;.com/rideshare/generated-title/</em> or <em>&#8230;.com/rideshare/could-be-anything/</em></p>
<p>Site in development is here:<br />
<a href="http://www.panictour.com/rideshare/" title="Site in question.">http://www.panictour.com/rideshare/</a></p>
<p>Postscript:<br />
Have you ever released your &#8220;preview comment&#8221; code? I know hicks  has his version but your seems alot nicer.  I&#8217;d like to get ahold of yours if you don&#8217;t mind. By the way your site is very clean and professional.  I like it! </p>
<p>Thanks again  for the help.</p>
<p>-Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryan</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-226</link>
		<dc:creator>ryan</dc:creator>
		<pubDate>Sat, 15 Jan 2005 21:30:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-226</guid>
		<description>Works like a charm. Thanks for all your help. I appreciate it.

Thanks,

Ryan</description>
		<content:encoded><![CDATA[<p>Works like a charm. Thanks for all your help. I appreciate it.</p>
<p>Thanks,</p>
<p>Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marko</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-222</link>
		<dc:creator>marko</dc:creator>
		<pubDate>Sat, 15 Jan 2005 09:34:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-222</guid>
		<description>Ryan,

Regarding the code not showing up&#8212;use &#38;#60; instead of  &#60;, otherwise it will be stripped. You don't have to place any unnecessary spaces.

If you place &lt;code&gt;&#60;?php $pageName = "rideshare"; ?&gt;&lt;/code&gt;in your &lt;code&gt;index.php&lt;/code&gt;, then all the subpages will have a &#8216;name&#8217; &#8220;rideshare&#8221;, because all of them are actually this same &lt;code&gt;index.php&lt;/code&gt;, but with a different query strings. To make you this clear, place somewhere inside the &lt;code&gt;body&lt;/code&gt; following line &lt;code&gt;&#60;?php  echo $pageName; ?&gt;&lt;/code&gt;.

Following example should solve the header problem. You don&#8217;t have to label page with &lt;code&gt;$pageName&lt;/code&gt;:

&lt;code&gt;&#60;div id="&#60;?php if ($_SERVER["REQUEST_URI"] == '/rideshare/' /* or /rideshare.php or whatever URI for this page is... */) { echo 'ridesharetitle'; } else { echo 'hometitle'; } ?&gt;"&gt;&lt;/code&gt;. 

(&lt;code&gt;REQUEST_URI&lt;/code&gt; is the URI without &lt;code&gt;http://domainname.com&lt;/code&gt; and starts with a slash.</description>
		<content:encoded><![CDATA[<p>Ryan,</p>
<p>Regarding the code not showing up&#8212;use &#38;#60; instead of  &#60;, otherwise it will be stripped. You don&#8217;t have to place any unnecessary spaces.</p>
<p>If you place <code>&#60;?php $pageName = "rideshare"; ?></code>in your <code>index.php</code>, then all the subpages will have a &#8216;name&#8217; &#8220;rideshare&#8221;, because all of them are actually this same <code>index.php</code>, but with a different query strings. To make you this clear, place somewhere inside the <code>body</code> following line <code>&#60;?php  echo $pageName; ?></code>.</p>
<p>Following example should solve the header problem. You don&#8217;t have to label page with <code>$pageName</code>:</p>
<p><code>&#60;div id="&#60;?php if ($_SERVER["REQUEST_URI"] == &#8216;/rideshare/&#8217; /* or /rideshare.php or whatever URI for this page is&#8230; */) { echo &#8216;ridesharetitle&#8217;; } else { echo &#8216;hometitle&#8217;; } ?>&#8221;></code>. </p>
<p>(<code>REQUEST_URI</code> is the URI without <code><a href="http://domainname.com" rel="nofollow">http://domainname.com</a></code> and starts with a slash.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryan</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-221</link>
		<dc:creator>ryan</dc:creator>
		<pubDate>Fri, 14 Jan 2005 18:46:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-221</guid>
		<description>None of my code showed up! It did in the preview.</description>
		<content:encoded><![CDATA[<p>None of my code showed up! It did in the preview.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryan</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-220</link>
		<dc:creator>ryan</dc:creator>
		<pubDate>Fri, 14 Jan 2005 18:46:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-220</guid>
		<description>Thanks marko. I still can't get this to work. Works fine outside of WP but inside it does'nt.

Here is what I'm trying to do:

&lt;code&gt;&#60;div id= "&#60;?php if ($pageName == 'rideshare') { echo 'ridesharetitle'; } else { echo 'hometitle'; } ?&gt;"&gt;&lt;/code&gt;

This is in my WP index.php page on the very top:

&lt;code&gt;&#60;?php $pageName = "rideshare";  ?&gt;
&#60;?php require('./wp-blog-header.php');  ?&gt;
&#60;?php require_once('http://www.panictour.com/graphical/header.php'); ?&gt;&lt;/code&gt;

I'm doing image relplacements for  titles  for each page of my site. I have the corrispoding css id for each page in my css.  I have a header.php include where this code is being called. I include this header inside my wp index.php page.  This works outside of WP perfectly. * the "&#60;&gt;" have no pspaces of course.

Thanks for you help on this.

-ryan</description>
		<content:encoded><![CDATA[<p>Thanks marko. I still can&#8217;t get this to work. Works fine outside of WP but inside it does&#8217;nt.</p>
<p>Here is what I&#8217;m trying to do:</p>
<p><code>&#60;div id= "&#60;?php if ($pageName == 'rideshare') { echo 'ridesharetitle'; } else { echo 'hometitle'; } ?>"></code></p>
<p>This is in my WP index.php page on the very top:</p>
<p><code>&#60;?php $pageName = "rideshare";  ?><br />
&#60;?php require('./wp-blog-header.php');  ?><br />
&#60;?php require_once('http://www.panictour.com/graphical/header.php'); ?></code></p>
<p>I&#8217;m doing image relplacements for  titles  for each page of my site. I have the corrispoding css id for each page in my css.  I have a header.php include where this code is being called. I include this header inside my wp index.php page.  This works outside of WP perfectly. * the &#8220;&#60;>&#8221; have no pspaces of course.</p>
<p>Thanks for you help on this.</p>
<p>-ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marko</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-217</link>
		<dc:creator>marko</dc:creator>
		<pubDate>Fri, 14 Jan 2005 10:09:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-217</guid>
		<description>Ryan,

This is  a bit tricky solution, but try something like following code. You don&#8217;t have to name every page, just copy -&gt; paste or include it it where your navigation should be. You should enable mod_rewrite (read WP manual for this). &lt;code&gt;$_SERVER["REQUEST_URI"]&lt;/code&gt; returns something like &lt;code&gt;/wp/archive/2005/&lt;/code&gt;, depending on page requested.

&lt;code&gt;&#60;?php
    $nav_links = array(
        "home"             =&gt; "/",
        "archive"           =&gt; "/archive/"
    );    
    $requestedPage = $_SERVER["REQUEST_URI"];
    echo '&#60;ul id="mainNav"&gt;' . "\n";
    foreach ( $nav_links as $link_text =&gt; $link ) {
        if (strpos($requestedPage , $linkText) != false) {
            echo '&#60;li&gt;&#60;span&gt;' . $link_text . '&#60;/span&gt;&#60;/li&gt;' . "\n";
        } else {
            echo '&#60;li&gt;&#60;a href="' . $link. '"&gt;' . $link_text. '&#60;/a&gt;&#60;/li&gt;' . "\n";
        }
    }
    echo '&#60;/ul&gt;' . "\n";    
?&gt;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Ryan,</p>
<p>This is  a bit tricky solution, but try something like following code. You don&#8217;t have to name every page, just copy -> paste or include it it where your navigation should be. You should enable mod_rewrite (read WP manual for this). <code>$_SERVER["REQUEST_URI"]</code> returns something like <code>/wp/archive/2005/</code>, depending on page requested.</p>
<p><code>&#60;?php<br />
    $nav_links = array(<br />
        "home"             => "/",<br />
        "archive"           => "/archive/"<br />
    );<br />
    $requestedPage = $_SERVER["REQUEST_URI"];<br />
    echo &#8216;&#60;ul id=&#8221;mainNav&#8221;>&#8217; . &#8220;\n&#8221;;<br />
    foreach ( $nav_links as $link_text => $link ) {<br />
        if (strpos($requestedPage , $linkText) != false) {<br />
            echo &#8216;&#60;li>&#60;span>&#8217; . $link_text . &#8216;&#60;/span>&#60;/li>&#8217; . &#8220;\n&#8221;;<br />
        } else {<br />
            echo &#8216;&#60;li>&#60;a href=&#8221;&#8216; . $link. &#8216;&#8221;>&#8217; . $link_text. &#8216;&#60;/a>&#60;/li>&#8217; . &#8220;\n&#8221;;<br />
        }<br />
    }<br />
    echo &#8216;&#60;/ul>&#8217; . &#8220;\n&#8221;;<br />
?></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimbo</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-215</link>
		<dc:creator>Jimbo</dc:creator>
		<pubDate>Fri, 14 Jan 2005 09:13:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-215</guid>
		<description>This is a great solution and it avoids a query string which is what I most like about it, I used the exact same method when I first started making my new website a few months ago in PHP, before this post (still not live!).

Spooky.</description>
		<content:encoded><![CDATA[<p>This is a great solution and it avoids a query string which is what I most like about it, I used the exact same method when I first started making my new website a few months ago in PHP, before this post (still not live!).</p>
<p>Spooky.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryan</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-213</link>
		<dc:creator>ryan</dc:creator>
		<pubDate>Thu, 13 Jan 2005 23:16:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-213</guid>
		<description>I tryed your technique with a header include that is inside my wordpress application. I can&#8217;t get the  if/else statements to work. It just leaves it blank. 

Any ideas?</description>
		<content:encoded><![CDATA[<p>I tryed your technique with a header include that is inside my wordpress application. I can&#8217;t get the  if/else statements to work. It just leaves it blank. </p>
<p>Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryan</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-211</link>
		<dc:creator>ryan</dc:creator>
		<pubDate>Thu, 13 Jan 2005 17:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-211</guid>
		<description>I tried to explain this awhile back but didnt do such a good job as this! Thanks.

Here's what I had to say:

http://parrfolio.com/thoughts/index.php?p=19</description>
		<content:encoded><![CDATA[<p>I tried to explain this awhile back but didnt do such a good job as this! Thanks.</p>
<p>Here&#8217;s what I had to say:</p>
<p><a href="http://parrfolio.com/thoughts/index.php?p=19" rel="nofollow">http://parrfolio.com/thoughts/index.php?p=19</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: B.J. Schaefer</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-192</link>
		<dc:creator>B.J. Schaefer</dc:creator>
		<pubDate>Wed, 22 Dec 2004 00:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-192</guid>
		<description>&lt;p&gt;Duh.  Guess I should have double checked my code.  Oh well.  Anyway - I'm really digging your site (so many wonderful and thoughtful touches).  Oh, and, um, if you ever need a PHP/MySQL developer...you've got my email *wink wink* (too bad I don't live in Croatia)&lt;/p&gt;
&lt;p&gt;Peace out,
B.J. Schaefer&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Duh.  Guess I should have double checked my code.  Oh well.  Anyway - I&#8217;m really digging your site (so many wonderful and thoughtful touches).  Oh, and, um, if you ever need a PHP/MySQL developer&#8230;you&#8217;ve got my email *wink wink* (too bad I don&#8217;t live in Croatia)</p>
<p>Peace out,<br />
B.J. Schaefer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marko</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-191</link>
		<dc:creator>marko</dc:creator>
		<pubDate>Tue, 21 Dec 2004 10:53:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-191</guid>
		<description>B.J., this is excellent, because one doesn&#8217;t have to set conditions for each page. Now, the script handles it all automatically. I&#8217;ve just added the &lt;code&gt;&#60;li&gt;&lt;/code&gt;s in your example. Once again&#8212;great solution!</description>
		<content:encoded><![CDATA[<p>B.J., this is excellent, because one doesn&#8217;t have to set conditions for each page. Now, the script handles it all automatically. I&#8217;ve just added the <code>&#60;li></code>s in your example. Once again&#8212;great solution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: B.J. Schaefer</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-190</link>
		<dc:creator>B.J. Schaefer</dc:creator>
		<pubDate>Tue, 21 Dec 2004 02:27:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-190</guid>
		<description>Here's my oh-so-humble contribution.  This is a bit more extensible, and much easier to manage.
It uses the same concept as your example: set &lt;var&gt;$pageName&lt;/var&gt; to the name of the current page, and include the &lt;var&gt;mainNav.php&lt;/var&gt; file wherever you want it inserted.&lt;code&gt;
// mainNav.php
/*
  Put this up at the top.  It's a just simple array with the page name as the key, and the URL as the value.
*/
  $nav_links = array(
    "home" =&gt; "/",
    "products" =&gt; "/products/"
  );
&lt;/code&gt;
&lt;code&gt;
/*
  A simple foreach construct to cycle through each of the navigation links in the $nav_links array.  It checks against the key to see if it's the current page, and prints out a span instead of an anchor if so. 
*/
  print "&#60;ul id="mainNav"&gt;";
  foreach( $nav_links as $link_text=&gt;$link ){
    if( $link_text == $pageName ){
      print "&#60;li&gt;&#60;span&gt;$link_text&#60;/span&gt;&#60;/li&gt;";
    }
    else {
      print "&#60;li&gt;&#60;a href="$link"&gt;$link_text&#60;/a&gt;&#60;/li&gt;";
    }
  }
  print "&#60;/ul&gt;";
&lt;/code&gt;
Have Fun, and I hope this helps! ;)</description>
		<content:encoded><![CDATA[<p>Here&#8217;s my oh-so-humble contribution.  This is a bit more extensible, and much easier to manage.<br />
It uses the same concept as your example: set <var>$pageName</var> to the name of the current page, and include the <var>mainNav.php</var> file wherever you want it inserted.<code><br />
// mainNav.php<br />
/*<br />
  Put this up at the top.  It's a just simple array with the page name as the key, and the URL as the value.<br />
*/<br />
  $nav_links = array(<br />
    "home" => "/",<br />
    "products" => "/products/"<br />
  );<br />
</code><br />
<code><br />
/*<br />
  A simple foreach construct to cycle through each of the navigation links in the $nav_links array.  It checks against the key to see if it's the current page, and prints out a span instead of an anchor if so.<br />
*/<br />
  print "&lt;ul id="mainNav">";<br />
  foreach( $nav_links as $link_text=>$link ){<br />
    if( $link_text == $pageName ){<br />
      print "&#60;li>&lt;span>$link_text&lt;/span>&#60;/li>";<br />
    }<br />
    else {<br />
      print "&#60;li>&lt;a href="$link">$link_text&lt;/a>&#60;/li>";<br />
    }<br />
  }<br />
  print "&lt;/ul>";<br />
</code><br />
Have Fun, and I hope this helps! ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjen</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-113</link>
		<dc:creator>Arjen</dc:creator>
		<pubDate>Wed, 15 Dec 2004 16:58:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-113</guid>
		<description>Renaming seems to do the trick. Many thanks!
If only I understood why exactly this is happening...

Oh well, it works so I'm happy.

Thanks again.</description>
		<content:encoded><![CDATA[<p>Renaming seems to do the trick. Many thanks!<br />
If only I understood why exactly this is happening&#8230;</p>
<p>Oh well, it works so I&#8217;m happy.</p>
<p>Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marko</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-112</link>
		<dc:creator>marko</dc:creator>
		<pubDate>Wed, 15 Dec 2004 15:28:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-112</guid>
		<description>I don&#8217;t have an idea about this, but there is &lt;a href="http://webdesign.maratz.com/lab/faux_active_link/index.php"&gt;full working example&lt;/a&gt; and also a &lt;a href="http://webdesign.maratz.com/lab/faux_active_link/faux_active_link.zip"&gt;ZIP file&lt;/a&gt;, so you can check with it.

Try to rename file extension of &lt;code&gt;mainNav.php&lt;/code&gt; to &lt;code&gt;mainNav.php.txt&lt;/code&gt;, and then include it. The only explanation apart from misspelling is that the file which should be included is executed before including.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t have an idea about this, but there is <a href="http://webdesign.maratz.com/lab/faux_active_link/index.php">full working example</a> and also a <a href="http://webdesign.maratz.com/lab/faux_active_link/faux_active_link.zip">ZIP file</a>, so you can check with it.</p>
<p>Try to rename file extension of <code>mainNav.php</code> to <code>mainNav.php.txt</code>, and then include it. The only explanation apart from misspelling is that the file which should be included is executed before including.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjen</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-111</link>
		<dc:creator>Arjen</dc:creator>
		<pubDate>Wed, 15 Dec 2004 14:17:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-111</guid>
		<description>Hi Marko, thanks for the useful tutorial.

However, I have a small question about this. When I test this locally it works fine. When I upload it, the php gets included but somehow doesn't see the $pageName variable, so I never get the active link.

When I put this before the include:
&lt;code&gt;
echo $pageName ; 
&lt;/code&gt;

it nicely says: 'homePage'.  However the following menu include doesn't 'see' this. Any ideas??</description>
		<content:encoded><![CDATA[<p>Hi Marko, thanks for the useful tutorial.</p>
<p>However, I have a small question about this. When I test this locally it works fine. When I upload it, the php gets included but somehow doesn&#8217;t see the $pageName variable, so I never get the active link.</p>
<p>When I put this before the include:<br />
<code><br />
echo $pageName ;<br />
</code></p>
<p>it nicely says: &#8216;homePage&#8217;.  However the following menu include doesn&#8217;t &#8217;see&#8217; this. Any ideas??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dusoft</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-88</link>
		<dc:creator>dusoft</dc:creator>
		<pubDate>Fri, 19 Nov 2004 14:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-88</guid>
		<description>Even easier solution is just check for the page name if there are multiple pages used, e.g.:
&lt;pre&gt;
$basename=pathinfo($_SERVER["PHP_SELF"]);
$basename=$basename["basename"];
if ($basename=="book.php") //do something
elseif ($basename=="index.php") // do something
.
.
.
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Even easier solution is just check for the page name if there are multiple pages used, e.g.:</p>
<pre>
$basename=pathinfo($_SERVER["PHP_SELF"]);
$basename=$basename["basename"];
if ($basename=="book.php") //do something
elseif ($basename=="index.php") // do something
.
.
.
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: marko</title>
		<link>http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-86</link>
		<dc:creator>marko</dc:creator>
		<pubDate>Fri, 19 Nov 2004 08:55:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2004/11/18/faux-active-link/#comment-86</guid>
		<description>Trovster, you&#8217;re right! It&#8217;s fixed now : )</description>
		<content:encoded><![CDATA[<p>Trovster, you&#8217;re right! It&#8217;s fixed now : )</p>
]]></content:encoded>
	</item>
</channel>
</rss>
