If statement to style navigation/current page

20 posts by 3 authors in: Forums > CMS Builder
Last Post: June 15, 2009   (RSS)

Re: [Kittybiccy] If statement to style navigation/current page

By ross - May 29, 2009

Hi Hannah.

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:

$record['num'];

And your article page is a detail viewer so the record number will be something like

$church_endRecord['num']

try working with those :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Kittybiccy - June 2, 2009

Hi Ross,

I tried that but it then displays numbers 1 to 6 instead of the page title in the navigation. Any ideas?

Hannah

Re: [Kittybiccy] If statement to style navigation/current page

By ross - June 3, 2009

Hi Hannah

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?

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Kittybiccy - June 4, 2009

Hi Ross,

I'm confused too! Here are the links:
http://www.arcschoolsuk.com/CMSB/napton_teamList.php
http://www.arcschoolsuk.com/CMSB/napton_teamDetail.php

All the other pages in that navigation bar display a "current" colour when on.
Pages attached.

Thanks!

Re: [Kittybiccy] If statement to style navigation/current page

By ross - June 4, 2009

Hi Hannah

I think I am back on track here :).

<span class="current">

What I think you can do on team_list is something like this. Where you see "<?php echo $naptonRecord['title'] ?>" replace that with:

<?php ($naptonRecord['title'] == "meet the team"): ?>
<span class="current">
<?php endif ?>
<?php echo $naptonRecord['title'] ?>
</span>


The reason nothing was happening before is because on the team list page, there was no code telling the current link to change colour.

Give this a shot and let me know how you make out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Kittybiccy - June 11, 2009

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?

Link to page: http://www.arcschoolsuk.com/CMSB/napton_teamList.php

Thanks!

Re: [Kittybiccy] If statement to style navigation/current page

By ross - June 11, 2009

Hi Hannah

What kind of syntax errors were you getting? What I think you need to do is replace this bit if code:

&nbsp;&nbsp; <?php echo $naptonRecord['title'] ?></a>

with all this:

<?php ($naptonRecord['title'] == "meet the team"): ?>
<span class="current">
<?php endif ?>
<?php echo $naptonRecord['title'] ?>
</span>


If you use a line counter, the code starts on line 104 of napton_teamList.php

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.

Let me know how you make out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Kittybiccy - June 12, 2009

I get this: Parse error: syntax error, unexpected ':' in /homepages/31/d271660971/htdocs/CMSB/napton_teamList.php on line 107

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?

Re: [Kittybiccy] If statement to style navigation/current page

By ross - June 15, 2009

Hi Hannah.

I missed a "if" in my code. Could you try:

<?php if ($naptonRecord['title'] == "meet the team"): ?>

as the first line?

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/