CSS Current page

21 posts by 7 authors in: Forums > CMS Builder
Last Post: March 18, 2009   (RSS)

By chassa2556 - June 23, 2008

Is there a way of editing the active page tag in CSS so that the active page is highlighted in green.

http://www.straloch.com/newsite/indexpages.php?1&theCategory=The+Dower+House

Many thanks in advance

Re: [chassa2556] CSS Current page

By Dave - June 23, 2008

Do you mean so that the currently selected menu item shows in green? Or something else?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CSS Current page

By chassa2556 - June 23, 2008

yes I mean that the currently selected page shows in green. So people have an indication where they are...Sorry I wasn't very clear!

Re: [chassa2556] CSS Current page

By Dave - June 23, 2008

Ok, and the category name is always in the url as theCategory=... is that right? Can you past the few lines of code that displays the category name? Or attach indexpages.php to this post so I can see it?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CSS Current page

By chassa2556 - June 23, 2008

have included attachment for you to look at. thanks
Attachments:

indexpages.php 6K

Re: [chassa2556] CSS Current page

By Dave - June 23, 2008

Thanks, It looks like it might be in secondarynav.php. Do you want to just send me FTP to dave@interactivetools.com and I can update it for you? (Email, don't post FTP details in forum). That way I can easily get to any other files I need. I'll post back what I changed here.

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CSS Current page

By Dave - June 23, 2008

I've responded by email but here's how I did. It's a little hard because this site is a bit more complicated with it's structure but here they are:

You can see the green highlighting on the secondary menu for this page:
http://www.straloch.com/newsite/secondary.php?8&theCategory=Straloch+Estate

I edited secondarynav.php, added this code to get the current record number:
$num = getNumberFromEndOfUrl();

And this code to display the class in the foreach loop
<?php if ($num == $record['num']): ?>greenbuttons<?php endif; ?>

For headernav.php I added this code:
<?php if (@$_GET['theCategory'] == $pagesRecord['title']): ?>greenbuttons<?php endif; ?>

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CSS Current page

Thought this might help others. This is what I do:
1) Set up a class named ".current" with the colours you want for the active link.
2) Use this code in the link:
<a href="page.php?category=something" <?php if ($category == "something") { echo "class=\"current\"";} ?> >link</a>

Peter

Re: [Dave] CSS Current page

By Djulia - March 11, 2009

Hi Dave,

I have a problem which I am not able to solve with the [font "Times New Roman"]$num
condition.[font "Times New Roman"]

<?php if ($num == $record['num']): ?>greenbuttons<?php endif; ?>

The value of $record['num']): is ever modified.
It always preserves the value of the first recording in the table.


But, my approach is perhaps not the good one...
I want to obtain the entries of the table to build a menu and to identify the recording to emphasize it with a style.

You have an idea ?

Thanks,

Djulia

Attachments:

nav.php 1K