Forums / Setup & design / can {include uri=...} return a value in a variable?
nigel dodd
Tuesday 19 July 2005 6:09:52 am
I thought {include uri=...} would work like its namesake in C however, although it can receive variables from the calling script, it does not seem to return variables. Is this correct or is there some obscure namespace issue I am ignoring?
Patrick ALLAERT
Friday 19 August 2005 12:56:47 am
I am also interested in this...
In fact I would like to use a template like an API:
{include uri='api/company/getProducts.tpl' company_id=125 } {* Looping through results *} {section loop=$results} ... {/section}
Does someone know how to do this ? Namespaces should probably be used with some set's and let's but I am unable to do it :(
Patrick ALLAERT http://www.dixite.com/ http://users.pandora.be/patrick_allaert/
dexen deVries
Tuesday 20 March 2007 4:08:36 am
I second this, being able to return a value or tuple of values from included template would allow to share pieces of code among template. That'd reduce ammount of code duplication and easy maintenance.
Anybody ready to hax eZ Publish and add this feature? Or is it already included, just not well documented well enough?
Nabil Alimi
Tuesday 20 March 2007 5:12:48 am
Hi people,
You can store the result of a template using the {set-block} statements : http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_functions/variables/set_block. Note that only HTML will be stored in the newly created variable.Because of this, having a template working as an operator isnt possible. The best reason for that is that this is not what templating is meant for.
Hope it helped. :)Best regards.
My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com eZ Publish Freelance developper. Feel free to contact me +33 674 367 057 nabil at assiki d0t fr