Re: Adding line breaks in Title and Menu text

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
henson
Forum Members
Forum Members
Posts: 20
Joined: Mon Sep 17, 2007 11:17 pm

Re: Adding line breaks in Title and Menu text

Post 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
Jonny
Forum Members
Forum Members
Posts: 77
Joined: Sun Sep 24, 2006 10:49 am

Re: Adding line breaks in Title and Menu text

Post 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?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Adding line breaks in Title and Menu text

Post 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...
Jonny
Forum Members
Forum Members
Posts: 77
Joined: Sun Sep 24, 2006 10:49 am

Re: Adding line breaks in Title and Menu text

Post by Jonny »

Many thanks Dr.CSS.

The shocking truth is that I was editing the wrong template. :o

Spaces don't seem to make any difference here. menu / text works as well as menu/text.
Post Reply

Return to “CMSMS Core”