RE: [SMARTY] Question: Injecting template code within a currently processed template

From: Date: Wed, 13 Nov 2002 14:59:15 +0000
Subject: RE: [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-6418@lists.php.net to get a copy of this message
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 >

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