Global variable ?????

Author Message

patrice brun

Saturday 08 May 2010 1:15:52 pm

Hello,
I would like to pass a variable in the pagelayout
I tried with the following code:

in my template :

{def $total_items=0}
{set scope='global' $total_items=0}

In my pagelayout :

{$#total_items}

but this does not work, have you any idea?
Thank you

Gaetano Giunta

Sunday 09 May 2010 5:24:36 am

If you are doing this inside a node view template, you should use the persistent_variable mechanism instead, as it will work even when you activate the view cache.

Principal Consultant International Business
Member of the Community Project Board

patrice brun

Sunday 09 May 2010 2:05:08 pm

Thank you Gaetano
but precisely because I am not inside a template node that I would use a global variable.Have you an idea that I can pass the variable of my template to my pagelayout.
Thank you

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 30 2025 00:44:07
Script start
Timing: Jan 30 2025 00:44:07
Module start 'layout'
Timing: Jan 30 2025 00:44:07
Module start 'content'
Timing: Jan 30 2025 00:44:07
Module end 'content'
Timing: Jan 30 2025 00:44:07
Script end

Main resources:

Total runtime0.0131 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0000151.1953
Module start 'layout' 0.00570.0021 739.195336.6016
Module start 'content' 0.00780.0042 775.796990.2188
Module end 'content' 0.01200.0011 866.015629.9922
Script end 0.0131  896.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002417.9858140.0002
Check MTime0.00107.9109140.0001
Mysql Total
Database connection0.00118.366910.0011
Mysqli_queries0.001914.808030.0006
Looping result0.00000.069010.0000
Template Total0.00085.910.0008
Template load0.00064.489610.0006
Template processing0.00021.409910.0002
Override
Cache load0.00043.170510.0004
General
dbfile0.00021.813380.0000
String conversion0.00000.052740.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