How can I add List Selection into php description?
4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 23, 2010 (RSS)
By (Deleted User) - August 20, 2010
There is a drop down list with the following in each list:
mil | Military
med | Medical
saf | Safety
aer | Aerospace
Basically I have a sidebar with a load of multi list titles and url's used for sub navigation. When a new section is added to the multi record it displays the title in the sidebar nav. All works nicely.
When you go to the actual multi record detail page, I would like the sub nav to indicate it's active using css. I have seen this article and like the idea of using php to indicate the correct title and change it's colour. http://www.alistapart.com/articles/keepingcurrent/#
Now, as you can see above I have 3 letter description for each section, like mil, med, saf etc.
<?php $thisPage="About Us"; ?>
How can I replace the above "About Us" to display the chosen drop down list. For example: <?php $thisPage="mil"; ?>
Once I have this I can then crack on and add the css etc.
Any ideas? Thanks Jono
Re: [jonoc73] How can I add List Selection into php description?
By Jason - August 20, 2010
If you could provide a link to one of your pages and attach a copy of the code you're currently using, I can take a look at it for you.
Thanks.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] How can I add List Selection into php description?
By (Deleted User) - August 20, 2010
jono
Re: [jonoc73] How can I add List Selection into php description?
By Jason - August 23, 2010
You could try using this code:
<?php $currentSector = getLastNumberInUrl(); ?>
<?php foreach ($secRecords as $record): ?>
<li <?php if ($record['num']==$currentSector) echo " class=\"currentpage\""; ?>>
<a href="/sectors/<?php echo $record['url_keywords'] ?>-<?php echo $record['num'] ?>"><?php echo $record['list_title'] ?></a></li>
<?php endforeach ?>
This will work on any page. What it does is get the record number from the url. When it's outputting the different links, it will make the record that is currently selected have the class "currentpage"
Give that a try.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/