View previous topic :: View next topic |
Author |
Message |
brainwave Smarty Rookie
Joined: 09 Jul 2003 Posts: 22
|
Posted: Wed Jul 09, 2003 2:25 pm Post subject: parsing some code |
|
|
Hi,
i want to parse some code like BBCODE and SMILIES directly by smarty! is this possible?
If yes, is it slower than parsing by PHP-code with "ereg_replace()"?
Greetings
Sascha |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Jul 09, 2003 4:05 pm Post subject: |
|
|
Hi.
There is a BBCODE plugin for Smarty at the Wiki -- see here. The plugin, like Smarty itself, uses preg_replace. |
|
Back to top |
|
brainwave Smarty Rookie
Joined: 09 Jul 2003 Posts: 22
|
Posted: Thu Jul 10, 2003 7:00 am Post subject: |
|
|
ok thx thats great! but... how i use this plugin? sorry i'm a smarty-newbie! |
|
Back to top |
|
brainwave Smarty Rookie
Joined: 09 Jul 2003 Posts: 22
|
Posted: Mon Jul 14, 2003 8:52 am Post subject: |
|
|
please help me! |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Mon Jul 14, 2003 11:12 am Post subject: |
|
|
Copy the code into modifier.bbcode2html.php in your smarty plugins directory. Then in your template do something like:
{assign var="blah" value="[b][url]http://smarty.php.net[/url][/b]"}
{$blah|bbcode2html} _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
brainwave Smarty Rookie
Joined: 09 Jul 2003 Posts: 22
|
Posted: Mon Jul 14, 2003 11:42 am Post subject: |
|
|
and in my PHP-code is nothing to do? |
|
Back to top |
|
Enquest Smarty Regular
Joined: 14 May 2003 Posts: 79
|
Posted: Mon Jul 14, 2003 2:23 pm Post subject: |
|
|
Does that include nl2br or do you need to put the code in modifier.nl2br.php?
If I do exact what you say. It "{$val|bbcode2html} it only spits out the code it self of the plugin. With other words you see the ereg code of modifier.bbcode2html.php _________________ -----------------------
Learning my self by trying to help others |
|
Back to top |
|
Enquest Smarty Regular
Joined: 14 May 2003 Posts: 79
|
Posted: Mon Jul 14, 2003 2:35 pm Post subject: |
|
|
Easy solution
Don't forget when you copy and paste to put along <?php "paste" ?>
And to have nl2br also you can put $argu[0].var|bbcode2html|nl2br _________________ -----------------------
Learning my self by trying to help others |
|
Back to top |
|
|