<?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"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Highlight Current Page Using PHP Includes</title> <atom:link href="http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/feed/" rel="self" type="application/rss+xml" /><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/</link> <description>ElanMan&#039;s Code Snippets</description> <lastBuildDate>Wed, 18 Jan 2012 12:55:26 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: nurul</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-380</link> <dc:creator>nurul</dc:creator> <pubDate>Wed, 04 Jan 2012 08:06:00 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-380</guid> <description>hi...thanks for the tutorial but i cant seem to apply it to my code:
&lt;pre lang=&quot;php&quot;&gt;
&lt;a href=&quot;page.php?pageid=h&quot; rel=&quot;nofollow&quot;&gt;Home&lt;/a&gt;
&lt;a href=&quot;page.php?pageid=services&quot; rel=&quot;nofollow&quot;&gt;Services&lt;/a&gt;
&lt;a href=&quot;page.php?pageid=pricing&quot; rel=&quot;nofollow&quot;&gt;Pricing&lt;/a&gt;
&lt;a href=&quot;page.php?pageid=portfolio&quot; rel=&quot;nofollow&quot;&gt;Portfolio&lt;/a&gt;
&lt;a href=&quot;page.php?pageid=contactus&quot; rel=&quot;nofollow&quot;&gt;Contact Us&lt;/a&gt;
&lt;/pre&gt;
can you help? thanks</description> <content:encoded><![CDATA[<p>hi&#8230;thanks for the tutorial but i cant seem to apply it to my code:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">          <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page.php?pageid=h&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span><span style="color: #339933;">&gt;</span>Home<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
          <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page.php?pageid=services&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span><span style="color: #339933;">&gt;</span>Services<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
          <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page.php?pageid=pricing&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span><span style="color: #339933;">&gt;</span>Pricing<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
          <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page.php?pageid=portfolio&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span><span style="color: #339933;">&gt;</span>Portfolio<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
          <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page.php?pageid=contactus&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span><span style="color: #339933;">&gt;</span>Contact Us<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></div></div><p>can you help? thanks</p> ]]></content:encoded> </item> <item><title>By: James</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-372</link> <dc:creator>James</dc:creator> <pubDate>Fri, 02 Dec 2011 18:11:57 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-372</guid> <description>Thanks for the explanation, much simpler than the previous method I had toyed with.</description> <content:encoded><![CDATA[<p>Thanks for the explanation, much simpler than the previous method I had toyed with.</p> ]]></content:encoded> </item> <item><title>By: Thomas</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-338</link> <dc:creator>Thomas</dc:creator> <pubDate>Fri, 30 Sep 2011 14:18:47 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-338</guid> <description>I am a Php learner, and i have just started it, this is good example to set-up a current page highlighting automatically.
Thanks
Thomas</description> <content:encoded><![CDATA[<p>I am a Php learner, and i have just started it, this is good example to set-up a current page highlighting automatically.</p><p>Thanks</p><p>Thomas</p> ]]></content:encoded> </item> <item><title>By: Bossco</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-337</link> <dc:creator>Bossco</dc:creator> <pubDate>Thu, 29 Sep 2011 02:23:15 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-337</guid> <description>Hi ElanMan,
Thanks for a great tutorial.
I&#039;m learning a lot about PHP and my dynamic site which I&#039;m trying to build is really coming along now, thanks to your help amongst others.
Your code is functioning well as a side nav, unfortunately, like others I&#039;m having a real problem trying to work out how to incorporate the correct code to get selected links to highlight in the active state.
I&#039;ve been stuck on this one issue for a while now and no matter what code I try to put in, nothing seems to work.
Like one or two others, my navigation is based on a horizontal top menu, and a side menu for sub categories.
However, my links are dynamically linked from the index page. So they look like &#039;index.php?category=about&amp;page=about_content1...etc.&#039;
It&#039;s all working great....except for the fact that I can&#039;t get these side menu links to highlight at all in the active state.
I&#039;d really appreciate it if you could possibly help on this.
Thanks again for this tutorial.</description> <content:encoded><![CDATA[<p>Hi ElanMan,</p><p>Thanks for a great tutorial.<br
/> I&#8217;m learning a lot about PHP and my dynamic site which I&#8217;m trying to build is really coming along now, thanks to your help amongst others.</p><p>Your code is functioning well as a side nav, unfortunately, like others I&#8217;m having a real problem trying to work out how to incorporate the correct code to get selected links to highlight in the active state.</p><p>I&#8217;ve been stuck on this one issue for a while now and no matter what code I try to put in, nothing seems to work.<br
/> Like one or two others, my navigation is based on a horizontal top menu, and a side menu for sub categories.<br
/> However, my links are dynamically linked from the index page. So they look like &#8216;index.php?category=about&amp;page=about_content1&#8230;etc.&#8217;<br
/> It&#8217;s all working great&#8230;.except for the fact that I can&#8217;t get these side menu links to highlight at all in the active state.</p><p>I&#8217;d really appreciate it if you could possibly help on this.<br
/> Thanks again for this tutorial.</p> ]]></content:encoded> </item> <item><title>By: saqib ali</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-334</link> <dc:creator>saqib ali</dc:creator> <pubDate>Wed, 21 Sep 2011 12:09:02 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-334</guid> <description>hi, thanks for such a nice work just want to know as i am new in php when i tried this script it works fine but with that it also display class=&quot;current&quot; on the header need help to find solution</description> <content:encoded><![CDATA[<p>hi, thanks for such a nice work just want to know as i am new in php when i tried this script it works fine but with that it also display class=&#8221;current&#8221; on the header need help to find solution</p> ]]></content:encoded> </item> <item><title>By: Rajesh</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-330</link> <dc:creator>Rajesh</dc:creator> <pubDate>Sat, 10 Sep 2011 09:34:27 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-330</guid> <description>Hi ElanMan
Thanks for the great post. I am very new to PHP (its my 5th day learning PHP at the time of posting my query). i have picked up some understanding of PHP in these 5 days with the help of tutorials which have been published by generous and kind experts on the net. :) Today i learnt something from your post. I am working on my first PHP site and have written simple code to display pages dynamically. Now that i would like to add current page indicator code to my current code structure, i am stuck. Hope to get the solution here.
My question is same as Snetts. Snetts has managed to resolve it (refer to number 10 above). He has described it nicely. Thanks Snetts.
Part of the code in my index.php goes like this:
Code in top_nav.php is as follows :
&lt;a href=&quot;index.php?webpage=aboutus&quot; rel=&quot;nofollow&quot;&gt;About Us&lt;/a&gt;
&lt;a href=&quot;index.php?webpage=products&quot; rel=&quot;nofollow&quot;&gt;Products&lt;/a&gt;
&lt;a href=&quot;index.php?webpage=contact&quot; rel=&quot;nofollow&quot;&gt;Contact Us&lt;/a&gt;
&lt;a href=&quot;index.php&quot; rel=&quot;nofollow&quot;&gt;Home&lt;/a&gt;
&lt;!-- end of id topnav /--&gt;
Your help is highly appreciated.
Hi Snetts, care to share the code which resolved the issue.
Best regards and thanks in advance.</description> <content:encoded><![CDATA[<p>Hi ElanMan<br
/> Thanks for the great post. I am very new to PHP (its my 5th day learning PHP at the time of posting my query). i have picked up some understanding of PHP in these 5 days with the help of tutorials which have been published by generous and kind experts on the net. <img
src='http://www.elanman.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Today i learnt something from your post. I am working on my first PHP site and have written simple code to display pages dynamically. Now that i would like to add current page indicator code to my current code structure, i am stuck. Hope to get the solution here.</p><p>My question is same as Snetts. Snetts has managed to resolve it (refer to number 10 above). He has described it nicely. Thanks Snetts.</p><p>Part of the code in my index.php goes like this:</p><p>Code in top_nav.php is as follows :</p><p><a
href="index.php?webpage=aboutus" rel="nofollow">About Us</a><br
/> <a
href="index.php?webpage=products" rel="nofollow">Products</a><br
/> <a
href="index.php?webpage=contact" rel="nofollow">Contact Us</a><br
/> <a
href="index.php" rel="nofollow">Home</a></p><p></p><p>Your help is highly appreciated.</p><p>Hi Snetts, care to share the code which resolved the issue.</p><p>Best regards and thanks in advance.</p> ]]></content:encoded> </item> <item><title>By: ElanMan</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-329</link> <dc:creator>ElanMan</dc:creator> <pubDate>Wed, 07 Sep 2011 21:17:00 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-329</guid> <description>Sorry Chris, the ? rel=&quot;nofollow&quot; shite should just be the closing php tag...
My plugins are messing up :)</description> <content:encoded><![CDATA[<p>Sorry Chris, the ? rel=&#8221;nofollow&#8221; shite should just be the closing php tag&#8230;<br
/> My plugins are messing up <img
src='http://www.elanman.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: ElanMan</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-328</link> <dc:creator>ElanMan</dc:creator> <pubDate>Wed, 07 Sep 2011 21:10:38 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-328</guid> <description>Hi Chris, something like the following should do:
&lt;pre lang=&quot;php&quot; line=&quot;1&quot; escaped=&quot;true&quot;&gt;
&lt;li&gt;&lt;a &lt;?php if (strpos($_SERVER[&#039;PHP_SELF&#039;], &#039;index.php&#039;)) {echo &#039;class=&quot;current&quot;&#039;;} else { echo &#039;href=&quot;index.php&quot;&#039;;} ? rel=&quot;nofollow&quot;&gt; &gt;Home Page&lt;/a&gt;&lt;/li&gt;
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>Hi Chris, something like the following should do:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre class="php" style="font-family:monospace;">&lt;li&gt;&lt;a <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'class=&quot;current&quot;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'href=&quot;index.php&quot;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span> ? rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">&gt;</span>Home Page<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span></pre></td></tr></table></div> ]]></content:encoded> </item> <item><title>By: Chris</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-327</link> <dc:creator>Chris</dc:creator> <pubDate>Wed, 07 Sep 2011 18:42:58 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-327</guid> <description>Hi ElanMan, thank you for this simple and brilliant solution!
Is there any way to modify it so the &quot;current&quot; tab/link in the menu is not linked?
i.e. I have tabs at the top of my page... your code helped me achieve the correct tab being selected when on a page.  But it still links to the current page.  I&#039;d like the current one to have the &lt;a href tag disabled.  Thank you again! :)</description> <content:encoded><![CDATA[<p>Hi ElanMan, thank you for this simple and brilliant solution!</p><p>Is there any way to modify it so the &#8220;current&#8221; tab/link in the menu is not linked?</p><p>i.e. I have tabs at the top of my page&#8230; your code helped me achieve the correct tab being selected when on a page.  But it still links to the current page.  I&#8217;d like the current one to have the &lt;a href tag disabled.  Thank you again! <img
src='http://www.elanman.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: ElanMan</title><link>http://www.elanman.co.uk/2009/01/highlight-current-page-using-php-includes/comment-page-1/#comment-313</link> <dc:creator>ElanMan</dc:creator> <pubDate>Mon, 22 Aug 2011 07:36:17 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=299#comment-313</guid> <description>Hi Sarah, the problem with what you&#039;re trying to achieve is that the page isn&#039;t being refreshed when the user clicks on one of the links. PHP therefore isn&#039;t suitable. Javascript is the answer and as you&#039;re already using it, just add another function to the click handler for each link which changes either the class name or the direct css property of the clicked link. If you&#039;re using jquery, this should be relatively simple to do.
Hope that&#039;s pointed you in the right direction :)</description> <content:encoded><![CDATA[<p>Hi Sarah, the problem with what you&#8217;re trying to achieve is that the page isn&#8217;t being refreshed when the user clicks on one of the links. PHP therefore isn&#8217;t suitable. Javascript is the answer and as you&#8217;re already using it, just add another function to the click handler for each link which changes either the class name or the direct css property of the clicked link. If you&#8217;re using jquery, this should be relatively simple to do.<br
/> Hope that&#8217;s pointed you in the right direction <img
src='http://www.elanman.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> </channel> </rss>
