Re: [SMARTY] prefilter problems. More INFO
| From: | Oscar Fernandez Sierra | Date: | Sun, 14 Jul 2002 15:51:35 +0000 |
| Subject: | Re: [SMARTY] prefilter problems. More INFO | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5293@lists.php.net to get a copy of this message | ||
I don't know it you are using an obsolete documentation for your Smarty version.
In page
http://smarty.php.net/manual/en/plugins.naming.conventions.html
http://smarty.php.net/manual/en/plugins.prefilters.postfilters.html
you have the syntax
------
And name should be a valid identifier (letters, numbers, and underscores only).
Some examples: function.html_select_date.php, resource.db.php, modifier.spacify.php.
The plugin functions inside the plugin files must be named as follows:
smarty_type_name()
The meanings of type and name are the same as before.
------
In your case, the function should be called smarty_prefilter_removehref(......
Greetings.
Joe Rice wrote:
>
> 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
--
Oscar Fernandez Sierra | Mundinteractivos - El Mundo |
Area de Internet | Pradillo, 42 |
oscar@el-mundo.net | 28002 - Madrid (SPAIN, EU) |
http://www.elmundo.es/ | Tel: (+34) 915864800 (Ext: 4616) |