Re: [SMARTY] prefilter problems. SOLUTION

From: Date: Sun, 14 Jul 2002 23:45:06 +0000
Subject: Re: [SMARTY] prefilter problems. SOLUTION
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5313@lists.php.net to get a copy of this message
i upgraded, and wrote a plugin. the plugin is a block function that provides exactly what i was trying to accomplish along with a lot more flexibility that i had hoped for. for those interested here is the plugin (very simple). <?php /* * Smarty plugin * ------------------------------------------------------------- * File: block.removehref.php * Type: block * Name: removehref * Purpose: strip <a href="URL">LINK</a> leaving the "LINK" * ------------------------------------------------------------- */ function smarty_block_removehref($params, $content, &$smarty) { if ($content) { $content = preg_replace("/<a href=.*?>(.*?)<\/a>/","$1",$content); echo $content; } } thanks to everyone who forced me to upgrade and read more of the manual than i ever wanted to. thanks for Smarty. joe Joe Rice(riceja@water-melon.net)@Fri, Jul 12, 2002 at 11:19:03PM -0500: > > I'm using smarty version 1.5.2 and tried to use the > example of prefilter form the 1.5.2 smarty manual > and it doesn't seem to be working. > > so, i altered it to fit my needs and it still isn't working. > > function remove_href($source) { > $source = preg_replace("/<a href=.*>/","",$source); > $source = preg_replace("/<\/a>/","",$source); > echo "HELLO"; > return $source; > } > > > $t->register_prefilter("remove_href"); > $t->display("email_inbox.tpl"); > > after testing it all my hyper links still work and > have the href. > > and HELLO is never echo'd > > > Any help would be appreciated. > > > thanks, > joe > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- How do i get rid of those words in my screen that are coming from you?

« previous php.smarty.general (#5313) next »