SV: [SMARTY] Question: Injecting template code within a currently processed template
| From: | Paolo Nesti Poggi | Date: | Thu, 14 Nov 2002 12:36:33 +0000 |
| Subject: | SV: [SMARTY] Question: Injecting template code within a currently processed template | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6433@lists.php.net to get a copy of this message | ||
Hi André,
would you share the code?
Both because I don't quite got the whole picture of what you wanted to
achieve, and because it at the same time sounds useful.
Bye
Paolo
> -----Oprindelig meddelelse-----
> Fra: André Rabold [mailto:arabold@nero.com]
> Sendt: 14. november 2002 13:18
> Til: smarty-general@lists.php.net
> Emne: Re: [SMARTY] Question: Injecting template code within a currently
> processed template
>
>
>
> I have found what I have searched. The plugin I needed does
> already exists:
> function.eval.php. I've created my own function which works
> excelent now :-D
>
> bye,
> André
>
>
> "André Rabold" <arabold@nero.com> schrieb im Newsbeitrag
> news:20021114074236.28941.qmail@pb1.pair.com...
> > Right, this sounds good. It is not the best solution but it's
> ok. I still
> > think a custom
> > include plugin would be a nicer cleaner way to implement this. It's not
> just
> > a simple
> > {include} I need but some PHP code must be executed before loading the
> > template.
> > Sure I could include the code via {php}{/php} but that's not
> really what I
> > want.
> >
> > Thanks for help anyway
> > André
> >
> >
> >
> > "Gary Loescher" <gary@loescher.org> schrieb im Newsbeitrag
> > news:000701c28b25$3c08b690$0aebf80c@cb767813a...
> > Why not just use {include file=$template myVars=$vars}
> > (or something similar)? For transformations before compilation, try
> > creating a prefilter:
> >
> > http://smarty.php.net/manual/en/plugins.prefilters.postfilters.html
> >
> > Gary
> >
> > >-----Original Message-----
> > >From: André Rabold [mailto:arabold@nero.com]
> > >Sent: Wednesday, November 13, 2002 8:02 AM
> > >To: smarty-general@lists.php.net
> > >Subject: [SMARTY] Question: Injecting template code within a
> > >currently processed template
> > >
> > >
> > >I want to create a plugin function which is able to dynamically include
> > >other templates. Such a function must be executed before the script
> > >is compiled and injects template code into the currently processed
> > >template.
> > >The only plugin type which could be able to solve my problem is the
> > >"compiler" plugin but it doesn't fit my needs. I could only do some
> > >regex replacements or something similar which isn't what i want.
> > >
> > >For now I solved the problem writing a normal function plugin:
> > >
> > ><?php
> > >function smarty_function_injectTemplate ($params, $smarty) {
> > > // ... do some stuff here
> > > $myTemplate = $params["template"];
> > > $smarty = new Smarty();
> > > $smarty->assign( $myVars );
> > > $smarty->display( $myTemplate );
> > >}
> > >?>
> > >
> > >This isn't nice :-( Does anybody has a better solution?
> > >
> > >Thanks in advance,
> > >André
> > >
> > >
> > >
> > >--
> > >Smarty General Mailing List (http://smarty.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>