Page 1 of 1

help for automatically writing the trademark symbol [SOLVED]

Posted: Tue Jun 07, 2011 9:05 pm
by Mich-adg
Hi,
i just bought the excellent "cmsms cookbook" from S.Goldstein. (m'm a beginner in smarty/php scripting). I found and interesting script in this book to replace a string by another.
It works very well on the page content, but i need to replace strings just in the menu.
How can this be done? Is there a function to affect the menu part?

Code: Select all

<?php
function smarty_cms_postfilter_trademark($tpl_output,&$smarty)
{
$result = explode(':', $smarty->_current_file);
if (count($result) > 0)
{
if ($result[0] == 'content')
{
$tpl_output = str_replace('myText','myText<sup>TM</sup>', $tpl_output);
}
}
return $tpl_output;
}
?>

Re: help for automatically writing the trademark symbol

Posted: Tue Jun 07, 2011 9:27 pm
by sjg
I'm glad you're enjoying the book!

RonnyK has an even easier solution for your problem. He suggests:

Code: Select all

{$node->menutext|replace:'Company Name':'Company Name&reg;'}
in you Menu Manager template.

Good Luck,
___Samuel___

Re: help for automatically writing the trademark symbol

Posted: Wed Jun 08, 2011 7:24 am
by Mich-adg
wow... a simple and clever solution by "god" himself ! Thank you very much !!