Random image - shuffle

Author Message

Niklas Gunnäs

Thursday 21 April 2005 5:26:57 am

I have installed the shuffle operator and it works when I test it with this code in pagelayout.tpl

{let randomised_array=fetch('content','tree', hash('parent_node_id', '177'))|shuffle}
{section name=random loop=$randomised_array}
{$:item.name} -- testing</br>
{/section}
{/let}

What I want to do is to show random images from Media library/images.

Xavier Dutoit

Thursday 21 April 2005 9:42:40 am

Hi,

Have you tried with the parent_node_id set to 51 (media/images) ?

then use an embed view (by default, it displays the image.

X+

http://www.sydesy.com

Niklas Gunnäs

Friday 22 April 2005 3:18:35 am

This code shows random image from folder 73. If I change it to 51 it shows nothing. Why?

{let randomised_array=fetch('content','tree', hash('parent_node_id', '73',
						class_filter_type, "include", class_filter_array, array(5)))|shuffle}
{section name=random loop=$randomised_array max=1}
<img src={$random:item.object.data_map.image.content[medium].full_path|ezroot} border="0">
{/section}
{/let}	

Felix Laate

Friday 22 April 2005 4:24:35 am

Hi Niklas!

Permission issue? Anonymous users need "read" permission to the media section (or at least the folders where your images are)

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Niklas Gunnäs

Friday 22 April 2005 5:37:52 am

Thanks Felix

You made my day....

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 20 2025 23:21:46
Script start
Timing: Jan 20 2025 23:21:46
Module start 'layout'
Timing: Jan 20 2025 23:21:46
Module start 'content'
Timing: Jan 20 2025 23:21:47
Module end 'content'
Timing: Jan 20 2025 23:21:47
Script end

Main resources:

Total runtime1.0225 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 587.9063151.2109
Module start 'layout' 0.00640.0030 739.117236.6484
Module start 'content' 0.00941.0124 775.7656624.2891
Module end 'content' 1.02180.0007 1,400.054711.8594
Script end 1.0225  1,411.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3151160.0002
Check MTime0.00130.1272160.0001
Mysql Total
Database connection0.00090.085110.0009
Mysqli_queries0.965094.3740650.0148
Looping result0.00060.0543630.0000
Template Total0.985296.420.4926
Template load0.00230.226220.0012
Template processing0.982996.130820.4915
Template load and register function0.00020.016710.0002
states
state_id_array0.00180.175910.0018
state_identifier_array0.00090.090220.0005
Override
Cache load0.00170.1673300.0001
Sytem overhead
Fetch class attribute can translate value0.00040.043930.0001
Fetch class attribute name0.00080.081180.0001
XML
Image XML parsing0.00280.274230.0009
class_abstraction
Instantiating content class attribute0.00000.0016100.0000
General
dbfile0.00390.3825280.0001
String conversion0.00000.000640.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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/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
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs