Want line break in menu title
jruberto - May 9, 2008 - 20:32
I have certain menu items where I'd like to include a line break between words (its a horizontal Nice Menu).
I'm hooked in using the phptemplate_menu_item_link() function in my template.tpl.php and am able to manipulate the title text, but if i stick any HTML in the title, the HTML doesn't get parsed, it just shows up in the menu title (like ABOUT<br />US). This is no different than the behavior of just including HTML in the menu title via the user interface.
Any ideas? Thanks!
Best,
j

use css
Rather than using markup, I would limit the width of the menu item itself and rely on "natural" word-wrapping. It could be as simple as
ul.nice-menu li {width:8em;}
to set a width for all menu-items, or you can specify widths for specific menu items using the id attributes of each list item.
yep that can work but..
Agreed, and I've had some success like that, but it needs to be manageable by the client via the Drupal user interface.
The best thing I can come up with for that is inserting a token in the menu title to cause a line break. Another thing that's in play is multi-lingual menus... it will be different from language to language, it would be better if the menu title drove the width of its container, rather than the opposite.
Thanks & let me know if something else comes to mind! --j