Forums / Templates, Stylesheets, Page Layout / highlight current link

highlight current link

Locked

Started by rob222 on 12 Nov 2007, 7:24 PM · Views: 2,866

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
12 Nov 2007, 7:24 PM
#1
rob222 avatar

rob222

New Zenner

Join Date:
Jan 2005
Posts:
15
Plugin Contributions:
0

highlight current link

is possible insert a code that assign a style at the menu in the header bar (bar of epages, privacy notice, etc.) and also in box (information, more Information) page when the link is activate?

12 Nov 2007, 7:38 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: highlight current link

I suppose you'd like to know how...

In general terms, you could put a test in each link display code (say Privacy notice) to check for $main_page == 'privacy' or whatever, and if true, set a class="activePage" for it.
Then style .activePage {} in your stylesheet to have whatever distinction you want.

30 Nov 2007, 4:55 PM
#4
talos avatar

talos

New Zenner

Join Date:
Nov 2007
Posts:
3
Plugin Contributions:
0

Re: highlight current link

Hi gjh42,

this is my first question on this forum (I found out every other infos searching with patience...).
Could you explain me how files I have to change and send an example of php code? For CSS I have no problems.
Thanks in advance!

talos

5 Dec 2007, 6:31 PM
#5
talos avatar

talos

New Zenner

Join Date:
Nov 2007
Posts:
3
Plugin Contributions:
0

Re: highlight current link

tried to resolve myself the problem...

  1. styled .active {} class in my stylesheet;

  2. created php code

<?php if($main_page == 'login') print ' class="active"'; ?>

for testing and printing;

Now. I tried to put it in tpl_ezpages_bar_header.php and tpl_header.php, but happens nothig.

Someone want to help me complete the work? :cry:

talos

5 Dec 2007, 7:00 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: highlight current link

The ez-pages bar is going to be difficult, because it is built completely dynamically. There is no fixed code to insert an appropriate class tag into.

The file where the class would have to be added is /includes/modules/ezpages_bar_header.php. I know the information is available to that file, but it will have to be extracted from a field of an array variable (?$page_query_list_header[$rows]['altURL']?), then probably massaged and compared against the current page so the
class="active"
text can be added to $page_query_list_header[$rows]['link'].

6 Dec 2007, 9:35 AM
#7
talos avatar

talos

New Zenner

Join Date:
Nov 2007
Posts:
3
Plugin Contributions:
0

Re: highlight current link

Ok gjh42,

I was realizing the difficulty. now I try to find a solution but it will be hard, I'm afraid.
The alternative is to substitute the dynamic ez pages bar with a one static, I'd have the code ready yet. But It's more exiting integrate than substitute!

anyway, thank's a lot and sorry my bad english!

talos

6 Dec 2007, 5:13 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: highlight current link

You might try adding an

echo $page_query_list_header[$rows]['link'];

to see exactly what that looks like in various circumstances. Then you may be able to isolate the relevant bit of information to compare with $current_page_base.

14 Mar 2008, 2:24 PM
#9
karl19 avatar

karl19

New Zenner

Join Date:
Jun 2007
Posts:
62
Plugin Contributions:
0

Re: highlight current link

Hi there,

I'm also trying to do this. I've got a main menu made up of both main-categories and EZ Pages and since the categories get an active class, it would be great to get the same for EZ Pages.

Not quite sure how to get it to work though, I'm not so good with arrays and with ZC arrays in particular. If I echo the suggestion

 echo $page_query_list_header[$rows]['link'];

I just get [my_domain]/# - and not quite sure what this tells me? If anyone has any more information about what to change specifically in ezpages_bar_header.php to get the active state to get printed, that would be great!

Thanks,
Karl