how can i access a php variable in a tpl file ?

Author Message

nuno emilio

Thursday 24 July 2003 5:23:05 am

when i create a php script in index.php that generate a variable, how can i access that variable in a tpl file ?? In http://ezwiki.blanko.info/index.php/3XHT_UsePHP they said to use {$variable} but this doesn't work for me ... can anyone help me ... thanks!

Tony Wood

Thursday 24 July 2003 5:37:39 am

Hi,

To get a variable into a template the best way is to write a custom operator.
http://www.ez.no/developer/ez_publish_3/documentation/development/kernel/custom_template_operators
It seems like a lot to start with but once you have written one, the next is easy :)

Take a look at eZRSS in the contributions http://www.ez.no/developer/ez_publish_3/contributions there is one called ezIPCountry that is similar too.

Good luck

Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

nuno emilio

Thursday 24 July 2003 9:00:36 am

Thanks a lot Tony ... works fine !!

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 04:30:45
Script start
Timing: Jan 31 2025 04:30:45
Module start 'layout'
Timing: Jan 31 2025 04:30:45
Module start 'content'
Timing: Jan 31 2025 04:30:45
Module end 'content'
Timing: Jan 31 2025 04:30:45
Script end

Main resources:

Total runtime0.0133 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.0058 588.2656151.2266
Module start 'layout' 0.00580.0023 739.492236.6797
Module start 'content' 0.00810.0040 776.171990.1875
Module end 'content' 0.01210.0011 866.359429.9922
Script end 0.0133  896.3516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002115.8403140.0002
Check MTime0.00107.3932140.0001
Mysql Total
Database connection0.00085.800810.0008
Mysqli_queries0.002821.133030.0009
Looping result0.00000.082310.0000
Template Total0.00086.410.0008
Template load0.00075.095810.0007
Template processing0.00021.245310.0002
Override
Cache load0.00053.489110.0005
General
dbfile0.00021.783980.0000
String conversion0.00000.051940.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