Hello Drupal Community, currently Iam working on my portfolio site and I want it to be available in two languages. Iam using the i18n module and its working good so far. The only thing Iam trying to solve is that my menu-structure should be easily switchable from one language to the other. On this site http://groups.drupal.org/node/13092#comment-56417 I found a code piece for the tpl.php which is doing nearly what I want. But I cant get it to work with my custom footer menu.
What Iam trying to achieve is to merge my actual footer call
<?php print
$footer_links = theme('links_secondary',menu_navigation_links('menu-footernavi'),array('class' => 'links', 'id' => 'footlist'));
?> with the support for the multilanguage switching
<?php
// Overloaded "menu_tree" function to support multilingual primary links
$menu_name = 'menu-footernavi';
static $menu_output = array();
if (!isset($menu_output[$menu_name])) {
$tree = menu_tree_page_data($menu_name);
// Leave only current language menus and language neutral menus
$current_language = $language->language;
if ( ! empty($tree) ) {
foreach ( $tree as $menu_key => $menu_link ) {
if ( $menu_link['link']['options']['langcode'] != $current_language &&
! empty( $menu_link['link']['options']['langcode'] ) ) {
unset( $tree[$menu_key] ) ;
}
}
}
$menu_output[$menu_name] = menu_tree_output($tree);
}
print_r ($menu_output[$menu_name]);
?>It should call the template 'links_secondary' because Iam using the delimiter presentation in my footer menu. Anybody out there who has an idea how to merge this together? best regards ben
Comments
I'm having a similar
I'm having a similar problem. I need to split the Primary Links from Secondary Links, whilst keeping the Locale functionality. Do you have any suggestion of how to do this?
Thanks
Andrew
-------------------
www.hoffi.com
Hmm what do you mean with
Hmm what do you mean with splitting the primary from the secondary-links? I think they are by default two different menus. Under admin/build/menu/settings you can tell them which menu they should display and although you can choose if the secondary links should give out the second level of the primary-links. If you want the locale function to work with your primary or secondary links then you can do it either in your theme or by using menu-blocks. I found the following information helpful
http://drupal.org/node/275705
http://drupal.org/node/313302
http://groups.drupal.org/node/13092
If you have more precise questions on the things you need to do or change then please dont hesitate to ask.
Thanks for such a prompt
Thanks for such a prompt reply.
I'd like to impliment the primary menu with sub links held within the same menu structure, so they appear under their parent menu item. I should have said secondary links as aposed to the secondary menu. I can do this when the menu tree isnt using the Locale by using the following:
The trouble is this code doesnt work with any language switchers and displays all menu items associated with any languages.
Thanks
Andrew
-------------------
www.hoffi.com
I tried your code in my
I tried your code in my page.tpl.php and the language switching works. Are you using the internationalization module with drupal6?
If so, then please have a look at the following approach stated on this site http://openflows.com/blog/mvc/2008/10/03/drupal-6-i18n-basics
The limitation to this solution is, that you have to maintain different menu trees for each language. If youre working on a complex site it might be frustrating to dig into the menu of each language. Another try could be to use this
in your page.tpl.php where you want your links to appear. For the secondary-links you have to change the first line to
$menu_name = 'secondary-links';With this approach you need to maintain one menu structure and choose the language for each menu entry.Thank you. However I wish to
Thank you. However I wish to split the child items from the Primary-Links menu structure.
I appologise for calling these secondary-links, this is not the case they are indeed still primary links, but children of the main items within the list. The reason I ask is that I wish to have tabs accross the top of the page with a left hand navigation underneath containing the child links. You could say that I wish to split the tree menu.
I know this is possible in Drupal 5 Themes and I believe its possible in 6 also, but I've had difficulty getting it working with the Locale module.
Thanks
Andrew
-------------------
www.hoffi.com
Well I think this is what
Well I think this is what Iam doing right now. Please have a look at this screenshot:
http://kisd.de/~brenes/mockup.gif
Under /admin/build/menu/settings you have to choose that the secondary menu is containing the primary menu:
"Select what should be displayed as the secondary links. You can choose the same menu for secondary links as for primary links (currently Primary). If you do this, the children of the active primary menu link will be displayed as secondary links. This is a multilingual variable."
And in my case this is also working with the internationalization module.