Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

parsing some code

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Wed Jul 09, 2003 2:25 pm    Post subject: parsing some code Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Jul 09, 2003 4:05 pm    Post subject: Reply with quote

Hi.

There is a BBCODE plugin for Smarty at the Wiki -- see here. The plugin, like Smarty itself, uses preg_replace.
Back to top
View user's profile Send private message
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Thu Jul 10, 2003 7:00 am    Post subject: Reply with quote

ok thx thats great! but... how i use this plugin? sorry i'm a smarty-newbie!
Back to top
View user's profile Send private message
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Mon Jul 14, 2003 8:52 am    Post subject: Reply with quote

please help me! Embarassed
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Mon Jul 14, 2003 11:12 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Mon Jul 14, 2003 11:42 am    Post subject: Reply with quote

and in my PHP-code is nothing to do?
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Mon Jul 14, 2003 2:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Mon Jul 14, 2003 2:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP