Setting random header images

Author Message

Sergei Chusmah

Thursday 16 August 2007 3:57:56 am

Hi, i'm new to ez and I have a simple question...

I have a template which overrides the standard pagelayout.tpl.
The template has an image inserted in its header. I'd like the image to change randomly, so I need to read the image filename from an ini file randomly and pass the result to the template.
I'd like to know where should I put the code that calculates then passes the var to the template. The code is not related to any module in particular, it must be executed in every page, so I don't know which php file should it be put into...

Many thanks in advace!

Softriva .com

Sunday 26 August 2007 9:58:13 am

This might be helpful

http://ez.no/community/forum/setup_design/fetching_random_content_combined_with_cache

Sergei Chusmah

Tuesday 28 August 2007 12:34:26 am

Thanks for the info. My main problem is getting some content into the template, though...

As the content belongs to the header template, which is displayed all pages, I don't know exactly where to put the code that generates it.

I'll try adding a fetch function to one of my modules and call it using the template fetch function from the header template... i don't know if that is the right way...

Thanks anyway!

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 18 2025 18:21:28
Script start
Timing: Jan 18 2025 18:21:28
Module start 'layout'
Timing: Jan 18 2025 18:21:28
Module start 'content'
Timing: Jan 18 2025 18:21:29
Module end 'content'
Timing: Jan 18 2025 18:21:29
Script end

Main resources:

Total runtime1.3189 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 589.0234152.6250
Module start 'layout' 0.00640.0043 741.648439.4453
Module start 'content' 0.01071.3069 781.0938467.0000
Module end 'content' 1.31760.0012 1,248.09388.1641
Script end 1.3188  1,256.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.2721160.0002
Check MTime0.00130.0956160.0001
Mysql Total
Database connection0.00060.044510.0006
Mysqli_queries1.276096.7531570.0224
Looping result0.00050.0372550.0000
Template Total1.275496.720.6377
Template load0.00210.159620.0011
Template processing1.273396.542620.6366
Template load and register function0.00020.018110.0002
states
state_id_array0.00150.115610.0015
state_identifier_array0.00170.129920.0009
Override
Cache load0.00170.1261160.0001
Sytem overhead
Fetch class attribute can translate value0.00050.035020.0002
Fetch class attribute name0.00080.063230.0003
XML
Image XML parsing0.00020.018020.0001
class_abstraction
Instantiating content class attribute0.00000.000530.0000
General
dbfile0.00140.1080100.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs