Page 1 of 1
Re: Adding line breaks in Title and Menu text
Posted: Thu Mar 18, 2010 5:02 pm
by henson
Hey didiero,
I don't know whether you know or not, but the {breadcrumbs|replace:'':'} syntax. where did you find out about that? Is it still functional in more up-to-date versions of cmsms? I have tried using it in one of my templates, but is just isn't working
Thanks
Marc
Re: Adding line breaks in Title and Menu text
Posted: Tue Jan 11, 2011 3:54 pm
by Jonny
CMSMS 1.9.2
I've tried the following, found on the forum, in my menu template for applying line breaks in menu text but with no joy.
Code: Select all
{$node->menutext|replace:'/':'<br />'}
Full template
Code: Select all
{if $count > 0}
<ul id="nav">
{foreach from=$nodelist item=node}{if $node->depth > $node->prevdepth}
{repeat string="
<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li>
</ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
<li class="current menuparent"><a class="current menuparent"{elseif $node->current == true}<li class="current"><a class="current"{elseif $node->haschildren == true}<li class="menuparent"><a class="menuparent" {elseif $node->type == 'sectionheader'}
<li class="sectionheader"><span>{$node->menutext|replace:'/':'<br />'}</span>{elseif $node->type == 'separator'}<li style="list-style-type: none;"><hr class="separator" />{else}<li><a{/if}{if $node->type != 'sectionheader' and $node->type != 'separator'} href="{$node->url}"{if $node->accesskey != ''}accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}{if $node->target ne ""}target="{$node->target}"{/if}>{$node->menutext|replace:'/':'<br />'}</a>{elseif $node->type == 'sectionheader'}>{$node->menutext|replace:'/':'<br />'}</a>{/if}{/foreach}{repeat string="</li>
</ul>" times=$node->depth-1}
</li>
</ul>{/if}
Used with menu text e.g. line 1/line 2
Have checked
Smarty Replace syntax.
Any ideas either why replace is not working here or an alternative solution for adding line breaks in a menu?
Re: Adding line breaks in Title and Menu text
Posted: Tue Jan 11, 2011 6:45 pm
by Dr.CSS
I just tried it on 1.9.2 and it works, if you do like so menu/text not like so menu / text, seems any space between words it won't work...
Re: Adding line breaks in Title and Menu text
Posted: Tue Jan 11, 2011 7:10 pm
by Jonny
Many thanks Dr.CSS.
The shocking truth is that I was
editing the wrong template.
Spaces don't seem to make any difference here. menu / text works as well as menu/text.