Page 1 of 1

UserDefinedTag issue

Posted: Fri Jun 23, 2006 11:27 pm
by dest
So, I set up a user defined tag for code display (so it doesn't parse it, and to look nicer when displaying).

I defined the tag as "code", and typed in the following (the c parameter would be the code I want displayed):

Code: Select all

if($params['c']!='')
{
 echo "<div style='margin-left:10%;font-size:smaller'><b>Code:</b>
 <div style='background-color:#eeeeee;border:1px solid black;'>";
 $code=$params['c'];
 $code=str_replace("<","&#60",$code);
 $code=str_replace(">","&#62",$code);
 $code=str_replace("{","&#123",$code);
 $code=str_replace("}","&#125",$code);
 echo $code;
 echo "</div></div>"
}
I then went to test this, and found out that it didn't work, because the editor had converted the html character codes back to the characters.  The str_replace()s now did nothing. 

I decided to try fixing this problem by going to phpmyadmin, finding where this was stored, and putting in the correct code.  Now, calling the {code} tag causes a tag-not-found error:
Fatal error: Smarty error: [in preview:cmspreviewmGQLao line 740]: syntax error: unrecognized tag 'code' (Smarty_Compiler.class.php, line 580) in /home/www/dev/cms/lib/smarty/Smarty.class.php on line 1095
Basic info:
-CMS Made Simple 0.13
-PHP 4.4.0
-Apache 1.3.33
-mySQL 4.0.24

I would appreciate any help. 

Re: UserDefinedTag issue

Posted: Fri Jun 23, 2006 11:35 pm
by calguy1000
1) turn wysiwyg off
2) copy the code you just pasted
3) delete any tag called code that shows up in the tag list
4) create a new tag called code, and click  "paste"

Re: UserDefinedTag issue

Posted: Sun Jun 25, 2006 3:42 am
by dest
WYSIWYG was already off. 

I've found the problem, though.  If you have bad code, when it redisplays with the error, it changes character codes to display the character.  I must have not noticed that when I did that last time.  ::)

Thanks, though.