<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>If statement to style navigation/current page</title>
        <link>https://interactivetools.com/forum/forum-posts.php?If-statement-to-style-navigation-current-page-69937</link>
        <description></description>
        <pubDate>Tue, 14 Jul 2026 09:30:16 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;If-statement-to-style-navigation-current-page-69937" rel="self" type="application/rss+xml" />

                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197754#post2197754</link>
          <description><![CDATA[Hi Hannah.<br /><br />I missed a &quot;if&quot; in my code. Could you try:<br /><br /><code>&lt;?php if ($naptonRecord['title'] == &quot;meet the team&quot;): ?&gt;</code><br /><br />as the first line?<br /><br />Thanks!<br />]]></description>
          <pubDate>Mon, 15 Jun 2009 10:49:36 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197754#post2197754</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197737#post2197737</link>
          <description><![CDATA[I get this: Parse error: syntax error, unexpected ':' in /homepages/31/d271660971/htdocs/CMSB/napton_teamList.php on line 107<br /><br />How would you suggest I hardcode these pages into the templates - the navigation is controlled by the CMSB. Would I just add it after the CMSB code in my page and take it out of the category menu system in the admin panel so it's it's own record?<br />]]></description>
          <pubDate>Fri, 12 Jun 2009 03:21:20 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197737#post2197737</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197723#post2197723</link>
          <description><![CDATA[Hi Hannah<br /><br />What kind of syntax errors were you getting?  What I think you need to do is replace this bit if code:<br /><br /><code>&amp;nbsp;&amp;nbsp; &lt;?php echo $naptonRecord['title'] ?&gt;&lt;/a&gt;</code><br /><br />with all this:<br /><br /><code>&lt;?php ($naptonRecord['title'] == &quot;meet the team&quot;): ?&gt; <br />	&lt;span class=&quot;current&quot;&gt; <br />&lt;?php endif ?&gt; <br />&lt;?php echo $naptonRecord['title'] ?&gt; <br />&lt;/span&gt;</code><br /><br />If you use a line counter, the code starts on line 104 of napton_teamList.php<br /><br />We'll figure out the other page after this one. If this all ends up still not working, another way to get it done might be to just hardcode the link to this page onto your templates.<br /><br />Let me know how you make out :).<br />]]></description>
          <pubDate>Thu, 11 Jun 2009 11:57:10 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197723#post2197723</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197721#post2197721</link>
          <description><![CDATA[Very frustrating! Tried that and adding similar bits of code and just get various syntax errors or it colours all to the current colour! Any more ideas lol? <br /><br />Link to page: http://www.arcschoolsuk.com/CMSB/napton_teamList.php<br /><br />Thanks!<br />]]></description>
          <pubDate>Thu, 11 Jun 2009 11:13:16 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197721#post2197721</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197676#post2197676</link>
          <description><![CDATA[Hi Hannah<br /><br />I think I am back on track here :).<br /><br />&lt;span class=&quot;current&quot;&gt;  <br /><br />What I think you can do on team_list is something like this. Where you see &quot;&lt;?php echo $naptonRecord['title'] ?&gt;&quot; replace that with:<br /><br /><code>&lt;?php ($naptonRecord['title'] == &quot;meet the team&quot;): ?&gt;<br />	&lt;span class=&quot;current&quot;&gt;<br />&lt;?php endif ?&gt;<br />&lt;?php echo $naptonRecord['title'] ?&gt;<br />&lt;/span&gt;</code><br /><br />The reason nothing was happening before is because on the team list page, there was no code telling the current link to change colour.<br /><br />Give this a shot and let me know how you make out :).<br />]]></description>
          <pubDate>Thu, 04 Jun 2009 12:13:27 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197676#post2197676</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197665#post2197665</link>
          <description><![CDATA[Hi Ross,<br /><br />I'm confused too! Here are the links:<br />http://www.arcschoolsuk.com/CMSB/napton_teamList.php<br />http://www.arcschoolsuk.com/CMSB/napton_teamDetail.php<br /><br />All the other pages in that navigation bar display a &quot;current&quot; colour when on.<br />Pages attached.<br /><br />Thanks!<br />]]></description>
          <pubDate>Thu, 04 Jun 2009 08:30:01 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197665#post2197665</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197659#post2197659</link>
          <description><![CDATA[Hi Hannah<br /><br />I don't quite get it.  I though you were just doing comparisons on that number and not displaying.  Could you post a link and attach you page for me again?<br /><br />Thanks!<br />]]></description>
          <pubDate>Wed, 03 Jun 2009 11:17:25 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197659#post2197659</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197655#post2197655</link>
          <description><![CDATA[Hi Ross,<br /><br />I tried that but it then displays numbers 1 to 6 instead of the page title in the navigation. Any ideas?<br /><br />Hannah<br />]]></description>
          <pubDate>Tue, 02 Jun 2009 05:54:18 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197655#post2197655</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197578#post2197578</link>
          <description><![CDATA[Hi Hannah.<br /><br />You can get the code right from your generator :).  I imagine your categories are being displayed as a list viewer so the record number will be something like:<br /><br />$record['num'];<br /><br />And your article page is a detail viewer so the record number will be something like<br /><br />$church_endRecord['num'] <br /><br />try working with those :).<br />]]></description>
          <pubDate>Fri, 29 May 2009 13:14:33 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197578#post2197578</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197556#post2197556</link>
          <description><![CDATA[I guess! So how would I do what you suggested in the post above:<br />&quot;if name from url = the name we are showing in the navigation, change its style&quot;<br /><br />Thanks!<br />]]></description>
          <pubDate>Thu, 28 May 2009 05:53:18 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197556#post2197556</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197470#post2197470</link>
          <description><![CDATA[Hi <br /><br />The number at the end there is always a record number. I think your nation.php pages are category menus right? So the the number at the end is the category record number.<br /><br />On your detail page, it has Head-Teacher-5 at the end so the record is number 5.<br /><br />It should still work. Technically, on that last link, the text you see there is just to help make the URL more readable. You could actually do something like <br /><br />napton_teamDetail.php?I-AM-ROSS-5 and the same article would show up because you still have that 5 at the end.<br /><br />Let me know if this helps. Thanks!<br />]]></description>
          <pubDate>Fri, 22 May 2009 12:17:41 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197470#post2197470</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197445#post2197445</link>
          <description><![CDATA[Hi Ross,<br /><br />The url's for the pages end in:<br />/napton.php?1, napton.php?2 etc (so numbered depending where the put the pages in the CMSB list)<br /><br />Until you get to the teamList/teamDetail page where it is: napton_teamList.php/napton_teamDetail.php?Head-Teacher-5.<br /><br />Would this have any effect?<br />]]></description>
          <pubDate>Thu, 21 May 2009 10:22:53 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197445#post2197445</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197413#post2197413</link>
          <description><![CDATA[Hi there.<br /><br />I didn't actually notice your last post was a question. I thought you had it all figured out and were just curious if there might be another way to do it.<br /><br />What I am thinking is that the name up in your URL is probably going to be the same as this variable on your page: $church_endRecord['title']<br /><br />So we could just do something like,<br /><br />if name from url = the name we are showing in the navigation, change its style<br /><br />Does that sound like it would work? Let me know what you think :).<br />]]></description>
          <pubDate>Mon, 18 May 2009 15:25:49 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197413#post2197413</guid>
        </item>
                <item>
          <title>Re: [rebjr] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197288#post2197288</link>
          <description><![CDATA[The navigation is controlled by the CMS Builder so that the client can add pages which will be included in the navigation and not have to come back to me at any point. I'm not sure that there is another 'easy' way that I could do this! But let me know if you think there is.<br />]]></description>
          <pubDate>Mon, 11 May 2009 03:22:02 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197288#post2197288</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197267#post2197267</link>
          <description><![CDATA[Have you considered doing this with CSS? It is much easier than trying to do it via CMS Builder and/or PHP. Here's an article that explains the basics:<br /><br /><a target="_blank" href="http://hicksdesign.co.uk/journal/highlighting-current-page-with-css">http://hicksdesign.co.uk/journal/highlighting-current-page-with-css</a><br /><br />Rob<br />]]></description>
          <pubDate>Fri, 08 May 2009 11:28:32 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197267#post2197267</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2197260#post2197260</link>
          <description><![CDATA[Hi Ross,<br /><br />I have been using the code to style the 'current' page and it is all working well except for (again) when you get to those difficult team list pages and the detail page. Is there something I will need to tweak here?<br /><br />This is the code to style the menu:<br />&lt;div id=&quot;menu&quot;&gt;&lt;ul&gt;  <br />&lt;li&gt;  <br />&lt;?php foreach ($church_endRecords as $church_endRecord): ?&gt;  <br />&lt;?php echo $church_endRecord['_listItemStart'] ?&gt;  <br />&lt;?php ?&gt;<br />&lt;?php if ($church_endRecord['linkOverride']): ?&gt; <br />	&lt;a href=&quot;&lt;?php echo $church_endRecord['linkOverride'] ?&gt;&quot;&gt; <br />&lt;?php else: ?&gt; <br />	&lt;a href=&quot;&lt;?php echo $church_endRecord['_link'] ?&gt;&quot;&gt; <br />&lt;?php endif ?&gt; <br />&lt;?php if ($church_endRecord['_isSelected']): ?&gt;  <br /><b>&lt;span class=&quot;current&quot;&gt;  <br />&lt;?php endif; ?&gt;<br />&lt;?php ?&gt;<br />&amp;nbsp;&amp;nbsp; &lt;?php echo $church_endRecord['title'] ?&gt;&lt;/a&gt;&lt;/span&gt;</b> <br /> <br />&lt;?php echo $church_endRecord['_listItemEnd'] ?&gt;  <br />&lt;?php endforeach; ?&gt;   <br />            &lt;/ul&gt;  <br />&lt;/li&gt; &lt;/div&gt;<br /><br />I will attach the page it's not working on, would be really really helpful if someone could have a look for me! This is what it is supposed to be doing:<br /><a target="_blank" href="http://www.arcschoolsuk.com/CMSB/church_end.php?5">http://www.arcschoolsuk.com/CMSB/church_end.php?5</a><br /><br />Thanks in advance!<br />]]></description>
          <pubDate>Fri, 08 May 2009 03:28:15 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2197260#post2197260</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196854#post2196854</link>
          <description><![CDATA[Hi Hannah<br /><br />That code would need to go right before where you display the category name.<br /><br /><code>&lt;?php if ($naptonRecord['_isSelected']): ?&gt; <br />&lt;b&gt; <br />&lt;?php endif; ?&gt;<br />CATEGORY NAME<br />&lt;/b&gt;</code><br /><br />Make sure to put in that &lt;/b&gt; after your category name or everything will go bold :).<br />]]></description>
          <pubDate>Thu, 09 Apr 2009 10:56:27 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196854#post2196854</guid>
        </item>
                <item>
          <title>Re: [ross] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196829#post2196829</link>
          <description><![CDATA[Thanks Ross!<br /><br />Where would this sort of thing need to go? I've tried putting it at difference places within the breadcrumb code but get different errors everytime like undefined variables etc! Should it specifically go within a part of the code that is working?<br /><br />Hannah<br />]]></description>
          <pubDate>Wed, 08 Apr 2009 03:33:21 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196829#post2196829</guid>
        </item>
                <item>
          <title>Re: [Kittybiccy] If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196818#post2196818</link>
          <description><![CDATA[Hi Hannah<br /><br />I think what you are going to be looking for here is the _isSelected option. You can do tests on it like this:<br /><br /><code>&lt;?php if ($naptonRecord['_isSelected']): ?&gt;<br />&lt;b&gt;<br />&lt;?php endif; ?&gt;</code><br /><br />You might need to play with that a bit to get the right effect.<br /><br />Let me know what you think.<br />]]></description>
          <pubDate>Tue, 07 Apr 2009 11:54:04 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196818#post2196818</guid>
        </item>
                <item>
          <title>If statement to style navigation/current page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196808#post2196808</link>
          <description><![CDATA[I'm trying to work out a way of styling some navigation so that when the viewer is on a pagel, the page in the navigation displays in a colour.<br /><br />The breadcrumb navigation is built to display titles of sections on certain pages - Ross helped me code this - but because these are not part of the HTML and are generated by the CMSB, I'm not sure how to get what I need.<br /><br />The code I'm using is like this:<br />&lt;?php foreach ($naptonRecords as $naptonRecord): ?&gt;  <br />  &lt;?php echo $naptonRecord['_listItemStart'] ?&gt;  <br />    <br />  &lt;?php ?&gt;<br />  &lt;?php if ($naptonRecord['linkOverride']): ?&gt; <br />    &lt;a href=&quot;&lt;?php echo $naptonRecord['linkOverride'] ?&gt;&quot;&gt; <br />      &lt;?php else: ?&gt; <br />      &lt;a href=&quot;&lt;?php echo $naptonRecord['_link'] ?&gt;&quot;&gt; <br />      &lt;?php endif ?&gt; <br />      <br />      &lt;?php ?&gt;<br />  &amp;nbsp;&amp;nbsp; &lt;?php echo $naptonRecord['title'] ?&gt;&lt;/a&gt;  <br />    <br />      &lt;?php echo $naptonRecord['_listItemEnd'] ?&gt;  <br />      &lt;?php endforeach; ?&gt;  <br /><br />Anyone know of an If statement or something I can add so that the current page displays in a colour?<br /><br />Any help/ideas/suggestions would be brilliant!<br />Hannah<br />]]></description>
          <pubDate>Tue, 07 Apr 2009 08:48:13 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196808#post2196808</guid>
        </item>
              </channel>
    </rss>
  