Re: [SMARTY] prefilter problems. More INFO
| From: | Joe Rice | Date: | Sun, 14 Jul 2002 15:04:46 +0000 |
| Subject: | Re: [SMARTY] prefilter problems. More INFO | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5287@lists.php.net to get a copy of this message | ||
Hi,
in an attempt to solve this problem i wrote a php
script that just creates the smarty instant, defines
the prefilter function, registers the prefilter, and
displays the template. the template is just a few
lines of html which include 5 href tags. the prefilter
worked the first time around but not after. so, i added
clear_cache and it still no longer works.
again, any help would be appreciated.
thanks,
joe
---test.php---
<?php
define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
require_once(SMARTY_DIR."Smarty.class.php");
$t = new Smarty;
function removehref($source) {
$source = preg_replace("/<a href=.*>/","",$source);
$source = preg_replace("/<\/a>/","",$source);
echo "HELLO";
return $source;
}
$t->clear_cache("fullofhref.tpl");
$t->register_prefilter("removehref",&$t);
$t->display("fullofhref.tpl");
?>
------------
----fullofhref.tpl---
<html>
<body>
<a href="http://www.yahoo.com">Yahoo!</a><br>
<a href="http://www.google.com">google</a><br>
<a href="http://www.php.net">PHP</a><br>
<a href="http://www.linux.com">Linux</a><br>
<a href="http://slashdot.org">slashdot</a><br>
</body>
</html>
--------------------
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?