can {include uri=...} return a value in a variable?

Author Message

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 01:25:29
Script start
Timing: Jan 31 2025 01:25:29
Module start 'layout'
Timing: Jan 31 2025 01:25:29
Module start 'content'
Timing: Jan 31 2025 01:25:29
Module end 'content'
Timing: Jan 31 2025 01:25:29
Script end

Main resources:

Total runtime0.0191 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0036 588.2656151.2266
Module start 'layout' 0.00360.0029 739.4922220.7188
Module start 'content' 0.00650.0111 960.21091,001.9609
Module end 'content' 0.01750.0015 1,962.171933.9922
Script end 0.0190  1,996.1641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002412.7836140.0002
Check MTime0.00105.4515140.0001
Mysql Total
Database connection0.00052.393610.0005
Mysqli_queries0.00168.222930.0005
Looping result0.00000.047510.0000
Template Total0.00105.510.0010
Template load0.00084.371710.0008
Template processing0.00021.064810.0002
Override
Cache load0.00062.901510.0006
General
dbfile0.00031.503980.0000
String conversion0.00000.026340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs