WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • highlight current page using showmenu2
  • Print
Pages: [1]   Go Down

Author Topic: highlight current page using showmenu2  (Read 7898 times)

Offline ivanisevic82

  • Posts: 94
highlight current page using showmenu2
« on: September 22, 2009, 11:37:32 AM »
Hi!
To highlight the current page there are a lot of solution html+css or js...but for all soluzione is necessary to know the name of alla the page of the site (to apply some selector, for example...).

So, if I create a menu with showmenu2, I don't know what and how many page I will create: everytime I add a page, it will be insert in the site by showmenu2.

Is there a solution to highlight the "current page", without know before, all the pages you will insert in the site?

Sorry for my english, I hope you understand the question.

Thank you!
Logged

PJW

  • Guest
Re: highlight current page using showmenu2
« Reply #1 on: September 22, 2009, 12:36:59 PM »
Hi,

I don't have a lot of experience with show_menu2, but I had a look at the code the other day.

IIRC the current page list element is given the class menu-current, so all you need to is add a css entry like:
Code: [Select]
.menu-current {
background:#ff0000;
text-decoration:none;
}
to highlight the current page in the menu, whatever its name is.

HTH,
Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #2 on: September 22, 2009, 01:44:23 PM »
Sorry, I wrote bad my question.

I don't want to highlight only the current page, but the "mother" page of corrent page too!

For example: if I have a "mother" horizontal menu and a vertical "son" menu, i want that is highlighted the son page and the relative mother page...

Is it possible?

Thanks!
Logged

erpe0812

  • Guest
Re: highlight current page using showmenu2
« Reply #3 on: September 22, 2009, 02:05:16 PM »
Yes in the same way.
It should be formatted as

Quote
.menu-parent {
background:#ff0000;
text-decoration:none;
}
Read your html output and you will find all classes but notice, that classes change by clicking.

rgds

erpe

Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #4 on: September 22, 2009, 02:57:59 PM »
Thank you my friend, now it's ok!  :-)

I only need the last help: I use this string to view the Current Page name:
Code: [Select]
<?php echo MENU_TITLE; ?>
I'd like to have something similar that allow me to view the Currente PARENT (or mother) page.

How can I do?

Thanks!
Logged

erpe0812

  • Guest
Re: highlight current page using showmenu2
« Reply #5 on: September 22, 2009, 03:13:45 PM »
By using breadcrumb code:
http://www.websitebakers.de/sm2/pages/enterprise.php

rgds

erpe

Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #6 on: September 22, 2009, 04:12:18 PM »
Ok boys, this problem is solved too! :D

Now really the last one :D ...

Here the link at the template I'm building:
http://www.ivanisevic82.com/pages/glass.php

As you can see in the top horizontal menu there are the parent; in the right vertical menu there are the children.

*** IMPORTANT *** You can use only the page "GLASS"; "PAGINA MADRE" like "Parent" and "PROVA1", "PROVA2" and "PROVA20" like children. Do not use other page because they are for a different job.

Let's go to my problem...

If you stay in the page "GLASS" all is ok: you can see only the parent page on the top horizontal menu and the children of "GLASS" ("PROVA1" and "PROVA2")  in the vertical menu.

To have this I used showmenu2 in this way:

For the Horizontal menu
Code: [Select]
<?php show_menu2(0, SM2_ROOT+0, SM2_CURR+0); ?>
For the Vertical menu
Code: [Select]
<?php show_menu2(0, SM2_ROOT+1, SM2_CURR+1); ?>
So, now try to go in a children page "PROVA1".
The vertical menu it's ok...but the horizontal top menu NO!
It add after the parent page, the children page (you can see only "PROVA1" becouse there is not so much space, but after there is "PROVA2").
You can make another try going to "PAGINA MADRE" > "PROVA20".

Why it happens??

To have the right situation as when I'm in a parent page, as when I'm in a children page, I have necessary to create two different template?

Thank you very very much and, as usually, sorry for my english!
« Last Edit: September 22, 2009, 04:18:51 PM by ivanisevic82 »
Logged

erpe0812

  • Guest
Re: highlight current page using showmenu2
« Reply #7 on: September 22, 2009, 04:17:53 PM »
Your sm2 calls are wrong

I have no time yet, maybe I can write it later on..........

Hope it helps for the first, read the documentation of sm2 and complete your calls.

rgds

erpe
Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #8 on: September 22, 2009, 04:20:17 PM »
I read documentation but I was not able to find solutions!

I'll wait for your help later or someone else before! :)

Thanks!
Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #9 on: September 23, 2009, 08:33:47 AM »
up...  :-)
Logged

snark

  • Guest
Re: highlight current page using showmenu2
« Reply #10 on: September 23, 2009, 08:43:40 AM »
Code: [Select]
<?php show_menu2(1,SM2_ROOT,SM2_START,&#39;&#39;,&#39;<li><a href="[url]" class="[class]">[menu_title]</a>&#39;,&#39;</li>&#39;,&#39;<ul>&#39;,&#39;</ul>&#39;,&#39;&#39;,&#39;&#39;); ?>
Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #11 on: September 23, 2009, 03:26:43 PM »
Thank you very much snark!

It's almost perfect, miss only a thing: I'd like that when I'm in a sub-page (child) the relative mother page stay "on".

So, using my site like example, when I'm in GLASS > PROVA1 I'd like to have the text hilighted not only for PROVA1 but for the mother "GLASS" too.

Is it possibile?

Thanks very much for your support!
Logged

snark

  • Guest
Re: highlight current page using showmenu2
« Reply #12 on: September 23, 2009, 04:54:36 PM »
#menu.menu-parent { }

have you tried to read the guides to showmenu2, it all is rather easy to use...
Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #13 on: September 23, 2009, 05:40:32 PM »
I tried to put it in my css:

Code: [Select]
#menu.menu-parent{
color:#f89f05;
text-shadow: 1px 1px 2px #000;
}

but it doesn't work...

Maybe I've done something wrong?

Thank you again!

Logged

Offline ivanisevic82

  • Posts: 94
Re: highlight current page using showmenu2
« Reply #14 on: September 23, 2009, 07:27:34 PM »
Hi find the solution!  :-D

<?php show_menu2(0, SM2_ROOT+0, SM2_START+0); ?>

without the long code posted ago...

Thank you!
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • highlight current page using showmenu2
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2