help for automatically writing the trademark symbol [SOLVED]

General project discussion. NOT for help questions.
Post Reply
Mich-adg
Forum Members
Forum Members
Posts: 199
Joined: Sat Aug 02, 2008 9:08 pm

help for automatically writing the trademark symbol [SOLVED]

Post 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;
}
?>
Last edited by Mich-adg on Wed Jun 08, 2011 7:24 am, edited 1 time in total.
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: help for automatically writing the trademark symbol

Post 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___
Mich-adg
Forum Members
Forum Members
Posts: 199
Joined: Sat Aug 02, 2008 9:08 pm

Re: help for automatically writing the trademark symbol

Post by Mich-adg »

wow... a simple and clever solution by "god" himself ! Thank you very much !!
Post Reply

Return to “General Discussion”