WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: Erwinvb on September 07, 2015, 01:30:53 PM

Title: Undo menubreak in breadcrumb
Post by: Erwinvb on September 07, 2015, 01:30:53 PM
I'm using the droplet "menubreak" to breakup the pagetitles in the Megamenu of template "bagslyd".

Works great but ... the breaks also show in de breadcrumb-string of the menu.
Is there anyone with a solution for the problem.

How do I filter the <br>-code from the breadcrumb-string but not from the menu-blocks?

Thanx in advance
Title: Re: Undo menubreak in breadcrumb
Post by: Ruud on September 07, 2015, 09:45:48 PM
The droplet "menubreak" a a very simple "replace all || into <br>" on all data in the generated page data.
If you do not want all menu's (like the breadcrumbs) to be replaced you should not use the droplet but work with the generated menu data.

The menu in the template you are using is generated in a variable first. (like $topmenu and $level0menue)
You could do the same "trick" in the template on the generated menu only.
Code: (example) [Select]
$menu = str_replace('||','<br/>', $menu);

If it is "$level0menue" that should be translated the code in the template would become:
Code: (untested) [Select]
$level0menue = '';
if (LEVEL == 0) {
ob_start();
show_menu2(1, SM2_ROOT+1, SM2_START, SM2_ALLINFO, '<li><a href="[url]" class="[class]" style="background-image:url('.$mpics_dir.'/[page_id].jpg);"><span><b>[menu_title]</b><i>[keywords]</i></span></a>', "</li>", '<ul>', '</ul>', true, '<ul>');
$level0menue = ob_get_contents();
ob_end_clean();
$level0menue = str_replace('||','<br/>', $level0menue);
if ($level0menue != '') {$level0menue = '<div class="topbox">'.$level0menue.'<div class="topboxclear"></div></div>';}
}
added the line "$level0menue = str_replace('||','<br/>', $level0menue);"