RE: Smarty 2.0 Prefilter
| From: | Monte Ohrt | Date: | Fri, 01 Mar 2002 14:24:30 +0000 |
| Subject: | RE: Smarty 2.0 Prefilter | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2909@lists.php.net to get a copy of this message | ||
Actually looking at your example here, this prefilter doesn't look like
something you would want applied to all of your templates. So instead of
putting this into the plugins directory, put the function somewhere in
your application and register it manually right before doing the fetch.
WiL Laxa wrote:
>
> How do i get the prefilter to filter the value of fetch if I don't have to
> do register_prefilter?
>
> $body = $template->fetch('_admin/users/templates/user_login.htm');
>
> prefilter.capture.php in the plugins directory
> ---------------------------
>
> function smarty_prefilter_capture($tpl_source)
> {
> eregi('<!--capture-->(.*)<!--/capture-->',$tpl_source,$match);
> return $match[1];
> }
>
> WiL
>
> -----Original Message-----
> From: Monte Ohrt [mailto:monte@ispi.net]
> Sent: Thursday, February 28, 2002 5:10 PM
> To: smarty@lists.ispi.net
> Subject: [smarty] RE: Smarty 2.0 Prefilter
>
> You don't have to register the plugin if it is in the plugin directory. get
> rid of the register_prefilter line.
>
> name the plugin file "prefilter.capture.php" and name the plugin function
> "smarty_prefilter_capture"
>
> > -----Original Message-----
> > From: WiL Laxa [mailto:wlaxa@blendermedia.com]
> > Sent: Thursday, February 28, 2002 7:07 PM
> > To: Monte Ohrt; smarty@lists.ispi.net
> > Subject: RE: [smarty] RE: Smarty 2.0 Prefilter
> >
> >
> > I've placed the code in the plugins directory as prefilter.capture.php and
> > now I'm trying to access it using this code:
> >
> > $template->register_prefilter('capture');
> > $body = $template->fetch('_admin/users/templates/user_login.htm');
> >
> > but the $body is still the same as if the prefilter wasn't registered.
> >
> > WiL
> >
> >
> > -----Original Message-----
> > From: Monte Ohrt [mailto:monte@ispi.net]
> > Sent: Thursday, February 28, 2002 4:32 PM
> > To: smarty@lists.ispi.net
> > Subject: [smarty] RE: Smarty 2.0 Prefilter
> >
> >
> > If you're using the 2.0 prototype, they go in the plugins directory.
> >
> > > -----Original Message-----
> > > From: WiL Laxa [mailto:wlaxa@blendermedia.com]
> > > Sent: Thursday, February 28, 2002 5:57 PM
> > > To: smarty@lists.ispi.net
> > > Subject: [smarty] Smarty 2.0 Prefilter
> > >
> > >
> > > Since there is no Smarty.addons.php file where do you place a template
> > > prefilter.
> > >
> > > <?php
> > >
> > > /*
> > > * Smarty plugin
> > > * -------------------------------------------------------------
> > > * Type: prefilter
> > > * Name: capture
> > > * Purpose: capture data between the the <!--capture--> tags
> > > * -------------------------------------------------------------
> > > */
> > >
> > > function capture($tpl_source) {
> > >
> > > eregi('<!--capture-->(.*)<!--/capture-->',$tpl_source,$match);
> > > return $match[1];
> > > }
> > >
> > > ?>
> > >
> > >
> > >
> > > ---
> > > You are currently subscribed to smarty as: monte@ispi.net
> > > To unsubscribe send a blank email to $subst('Email.Unsub')
> > > Visit Smarty's homepage at ÊcâiºŽM
> > > cÝU%http://www.phpinsider.com/php/code/Smarty/
> >
> > ---
> > You are currently subscribed to smarty as: wlaxa@blendermedia.com
> > To unsubscribe send a blank email to $subst('Email.Unsub')
> > Visit Smarty's homepage at
> > http://www.phpinsider.com/php/code/Smarty/
> >
> >
>
> ---
> You are currently subscribed to smarty as: wlaxa@blendermedia.com
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
Director of Technology, ispi Inc.