Re: [SMARTY] prefilter problems. More INFO

From: Date: Sun, 14 Jul 2002 20:59:23 +0000
Subject: Re: [SMARTY] prefilter problems. More INFO
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5310@lists.php.net to get a copy of this message
Why are you changing the prefilter? Once the template compiles, there shouldn't be a need to recompile it unless the template changes. If you have some kind of dynamic condition that requires changes to the prefilter, maybe you should pass a compile_id to get different compiled templates for different circumstances. Joe Rice wrote:
hi again, i upgraded to Smarty 2.2.0 and i was still having the same problem. Then reading the latest docs i notice clear_compiled_tpl. so, after using it on my template i now see the results of my prefilter every time. I was going on the idea that the compiled template was the cache. this brings up a new question. if prefilters only work the first time the template is compiled, then never touch the compiled template unless the template is modified, is there another way to parse the compiled template with a prefilter? like a compile_prefilter? i'm doing it now by calling clear_compiled_tpl before i register the prefilter, but i imagine this might not be the best way or the fastest. any help is appreciated. thanks, joe Joe Rice(riceja@water-melon.net)@Sun, Jul 14, 2002 at 10:12:35AM -0500:
after altering fullofhref.tpl the prefilter worked again. shouldn't clear_cache take care of this problem? thanks, joe Joe Rice(riceja@water-melon.net)@Sun, Jul 14, 2002 at 10:04:46AM -0500:
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? -- 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? -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


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