modifying menumanager not to encode HTML entities

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
zsero
Forum Members
Forum Members
Posts: 48
Joined: Mon Feb 13, 2006 4:39 pm

modifying menumanager not to encode HTML entities

Post by zsero »

I am trying to implement highlighted styling for specific menu items, described in that thread:
http://forum.cmsmadesimple.org/index.ph ... 812.0.html

I think since its not really a design question I might get better response here. What do you think its easier to let menumanager not convert HTML entities into encoded characters, or look for a smarter solution?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: modifying menumanager not to encode HTML entities

Post by calguy1000 »

This is simple, it's a one line change

find the line in MenuManager/MenuManager.module.php like:

Code: Select all

$onenode->menutext = my_htmlentities($content->MenuText());
and directly below it add:

Code: Select all

$onenode->raw_menutext = $content->MenuText();
then use

Code: Select all

{$node->raw_menutext}
in your menumanager templates.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
zsero
Forum Members
Forum Members
Posts: 48
Joined: Mon Feb 13, 2006 4:39 pm

Re: modifying menumanager not to encode HTML entities

Post by zsero »

Thank you Calguy!

I didn't think it could be as easy as this!

Now I have a 100% identical code to my older version, but have the ability to upgrade from 1.2.5 to 1.4.1!
joecannes
Forum Members
Forum Members
Posts: 93
Joined: Mon Nov 26, 2007 5:00 pm
Location: Montreal, Quebec

Re: modifying menumanager not to encode HTML entities

Post by joecannes »

QUestion;

I am the opposite, where I need HTML entities in my menu text. Do I:

1. Take out

Code: Select all

$onenode->raw_menutext = $content->MenuText();
in MenuManager.module.php?

and do I need to modify my menu template? This is my menu template:

Code: Select all

{if $count > 0}
<ul class="nav">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul class=\"nav2\">" 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->current == true}
<li class="currentpage"><a class="activeparent" href="{$node->url}" title="{$node->menutext}">{$node->menutext}</a>

{elseif $node->parent == true}
<li class="activeparent"><a class="activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"}"{else} title="{$node->menutext}"{/if}>{$node->menutext}</a>

{elseif $node->type == 'sectionheader'}
<li class="sectionheader"><h2 class="nav">{$node->menutext}</h2>

{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />

{else}
<li><a href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{else} title="{$node->menutext}"{/if}{if $node->target != ''} target="{$node->target}"{/if}>{$node->menutext}</a>

{/if}

{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
NaN

Re: modifying menumanager not to encode HTML entities

Post by NaN »

None of them.
HTML-Enities will be by default.
You only need to change if you want something "special".
If you didn't insert or change something you don't need to remove something or undo changes.
That's kind of logic isn't it ;)
Post Reply

Return to “Developers Discussion”