Hi all. I need to recreate this structure for a menu ("internalmenu" for the code below):
<li><a href="a1">link #1</a></li> <li><a href="s3">link #2</a></li> <li><a href="o9">link #3</a></li>
(I need to insert this content into a <div><ul> tags).
I have "played" with theme and mytheme_menu_item_link() hook:
function mytheme_menu_item_link($link) { switch ($link['menu_name']) { case 'menu-internalmenu': return "<li>".l(check_plain($link['link_title']), $link['link_path'])."</li>"; break;
default: return l($link['title'], $link['href'], $link['localized_options']); break; } }
but when I see the page source I see:
<span id="thmr_42" class="thmr_call"> <span id="thmr_48" class="thmr_call"> <div id="block-menu-menu-internalmenu" class="block block-menu"> <div class="content"> <span id="thmr_47" class="thmr_call"> <ul class="menu"> <span id="thmr_44" class="thmr_call"> <li class="leaf first active-trail"> </li> <li> <a class="active" href="/content/pagina-1">Pagina 1</a> </li> </span> <span id="thmr_46" class="thmr_call"> </span> </ul> </span> </div> </div> </span> </span>
I insert "internalmenu" menu into my page.tpl.php via a block contained in a region (via /admin/build/block).
Where is my error ?
Tnx for all.
M.
Hi The elements like:
<span id="thmr_42" class="thmr_call">
are inserted by Devel module. If you disable de Devel block or look at your source code with right clicking in your browser, you won't see any more this structure.
I wish that this information helps you.
Ramon
2009/9/8 Michel Morelli michel@ziobuddalabs.it:
Hi all. I need to recreate this structure for a menu ("internalmenu" for the code below):
<li><a href="a1">link #1</a></li> <li><a href="s3">link #2</a></li> <li><a href="o9">link #3</a></li>
(I need to insert this content into a <div><ul> tags).
I have "played" with theme and mytheme_menu_item_link() hook:
function mytheme_menu_item_link($link) { switch ($link['menu_name']) { case 'menu-internalmenu': return "<li>".l(check_plain($link['link_title']), $link['link_path'])."</li>"; break;
default: return l($link['title'], $link['href'], $link['localized_options']); break; } }
but when I see the page source I see:
<span id="thmr_42" class="thmr_call"> <span id="thmr_48" class="thmr_call"> <div id="block-menu-menu-internalmenu" class="block block-menu"> <div class="content"> <span id="thmr_47" class="thmr_call"> <ul class="menu"> <span id="thmr_44" class="thmr_call"> <li class="leaf first active-trail"> </li> <li> <a class="active" href="/content/pagina-1">Pagina 1</a> </li> </span> <span id="thmr_46" class="thmr_call"> </span> </ul> </span> </div> </div> </span> </span>
I insert "internalmenu" menu into my page.tpl.php via a block contained in a region (via /admin/build/block).
Where is my error ?
Tnx for all.
M.
-- Michel 'ZioBudda' Morelli michel@ziobuddalabs.net Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660
http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ziodrupal.net MSN: michel@ziobuddalabs.it JABBER: michel@ziobuddalabs.it
-- [ Drupal support list | http://lists.drupal.org/ ]
Ramon Vilar Gavaldà ha scritto:
Hi The elements like:
<span id="thmr_42" class="thmr_call">
are inserted by Devel module. If you disable de Devel block or look at your source code with right clicking in your browser, you won't see any more this structure.
I wish that this information helps you.
Oh yes. Thanks. Without Devel module all <div> code disappera, but there is one other thing: now my html is:
*<li class="leaf first active-trail"></li> //NOTE THIS <li><a href="/content/pagina-1" class="active">Pagina 1</a></li> <li class="leaf last"></li> //NOTE THIS <li><a href="/content/pagina-2">Pagina 2</a></li>
*Why drupal add 2 <li class="leaf ...."> ?
M.
<ul> <li class="leaf first">top</li> <li class="leaf ">middle</li> <li class="leaf last">bottom</li> </ul>
if you are going to create a dropdown menu,
the <li class="leaf first">top</li> is useful if what to round the topmost list like li.first { -mos... } the <li class="leaf last">bottom</li> is useful if what to round the bottom most list like li.first { -mos... }
like this example www.danielhonrade.com - open this in firefox to see the rounded corners
On Wed, Sep 9, 2009 at 3:30 PM, Michel Morelli michel@ziobuddalabs.itwrote:
Ramon Vilar Gavaldà ha scritto:
Hi The elements like:
<span id="thmr_42" class="thmr_call">
are inserted by Devel module. If you disable de Devel block or look at your source code with right clicking in your browser, you won't see any more this structure.
I wish that this information helps you.
Oh yes. Thanks. Without Devel module all <div> code disappera, but there is one other thing: now my html is:
*<li class="leaf first active-trail"></li> //NOTE THIS
<li><a href="/content/pagina-1" class="active">Pagina 1</a></li> <li class="leaf last"></li> //NOTE THIS <li><a href="/content/pagina-2">Pagina 2</a></li>
*Why drupal add 2 <li class="leaf ...."> ?
M.
-- Michel 'ZioBudda' Morelli michel@ziobuddalabs.net Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660 http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_buddahttp://www.ziodrupal.net MSN: michel@ziobuddalabs.it JABBER: michel@ziobuddalabs.it
-- [ Drupal support list | http://lists.drupal.org/ ]
Daniel Honrade ha scritto:
<ul> <li class="leaf first">top</li> <li class="leaf ">middle</li> <li class="leaf last">bottom</li> </ul>
if you are going to create a dropdown menu,
the <li class="leaf first">top</li> is useful if what to round the topmost list like li.first { -mos... } the <li class="leaf last">bottom</li> is useful if what to round the bottom most list like li.first { -mos... }
Ok you are right, but i'm not the person that have build the theme, I must to drupalize it only. So I want to know which is the function that add those lines to my code. It's not mytheme_menu_item_link().
M.
Hi Michel Can you attach or copy your theme function?
Ramon
Ramon Vilar Gavaldà ha scritto:
Hi Michel Can you attach or copy your theme function?
Ramon
function spaziocomo_menu_item_link2($link) { switch ($link['menu_name']) { case 'menu-internalmenu': return "<li>".l(check_plain($link['link_title']), $link['link_path'])."</li>"; break;
default: return l($link['title'], $link['href'], $link['localized_options']); break; } }
Note that I have changed the name in ...link2() because of the problem of the two <li>.
I think there's a better way to do this, just use dhtml_menu module, this will create ids for each li in the primary menu, you don't need to create funcitons, all you need is the function I gave you, the preprocess, because by default in drupal primary menus are only giving first level
On Wed, Sep 9, 2009 at 4:42 PM, Michel Morelli michel@ziobuddalabs.itwrote:
Ramon Vilar Gavaldà ha scritto:
Hi Michel Can you attach or copy your theme function?
Ramon
function spaziocomo_menu_item_link2($link) { switch ($link['menu_name']) { case 'menu-internalmenu': return "<li>".l(check_plain($link['link_title']), $link['link_path'])."</li>"; break;
default: return l($link['title'], $link['href'], $link['localized_options']); break; } }
Note that I have changed the name in ...link2() because of the problem of the two <li>.
-- Michel 'ZioBudda' Morelli michel@ziobuddalabs.net Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660
http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ziodrupal.net MSN: michel@ziobuddalabs.it JABBER: michel@ziobuddalabs.it
-- [ Drupal support list | http://lists.drupal.org/ ]
first you must expose the menu tree: (put this in the template.php)
function devavrata_extreme_preprocess_page(&$vars) { // Generate menu tree from source of primary links $vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links')); } }
this will expose all the menus and submenus like
ul li /li li /li ul li /li li /li /ul /ul
then, you need to use the firebug of firefox to see the ids and class
all you need to do now is to create css definitions like
#primary ul.menu li {} //first level #primary ul.menu li ul.menu li {} //second level #primary ul.menu li ul.menu li ul.menu li {} //third level
I use inline-block for the first level, position: absolute for the second, third levels
2009/9/9 Ramon Vilar Gavaldà ramon.vilar@gmail.com
Hi Michel Can you attach or copy your theme function?
Ramon
-- Ramon Vilar Gavaldà - http://ramonvilar.facil.cat - http://blog.facilitant.net Membre de FÀCIL - http://www.facil.cat Membre de l'esplai SESA - http://www.esplaisesa.org -- [ Drupal support list | http://lists.drupal.org/ ]