Suffle operator - Link on the image randomly selected

Author Message

Chris Lan

Monday 19 December 2005 7:35:11 pm

Hello,

I implemented the suffle operator to fetch images. I would like to add the link to the node id of the image on it. I tried that:


{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=3}  

<a href={$node.node_id}><img src={$random:item.object.data_map.image.content[medium].full_path|ezroot}  border="1"></a>
{node_view_gui view=element content_node=$random:item}
{/section}  
{/let} 
 

But of course, it can certainly not linked something randomly selected especially if it's a group of three. Ok I know the issue but I have no clue on how to solve it.

Does anybody did implement something similar???

Thanks for your help,
Chris

Björn Dieding@xrow.de

Tuesday 20 December 2005 12:39:23 am

have you tried this? I useally don't work with the property name of a section

so it should be either {$random.node_id} or {$random:item.node_id}.... the first element is alwys in this kind of fetch an object of ezcontentobjecttreenode

Try this too

{section loop=$randomised_array max=3}    
 <a href={$:item.node_id}>

 

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Chris Lan

Tuesday 20 December 2005 7:34:08 pm

Hi Björn,

Thank you for your answer! I just added the concat and it works just perfect. Thanks again!

Chris

<a href={concat('/content/view','/full/',$:item.node_id)|ezurl}> <img src={$random:item.object.data_map.image.content[medium].full_path|ezroot} align="center" border="1"></a>  

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

Main resources:

Total runtime0.7414 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.0046 589.2734152.6563
Module start 'layout' 0.00460.0023 741.929739.4922
Module start 'content' 0.00690.7332 781.4219546.6484
Module end 'content' 0.74010.0013 1,328.070312.1250
Script end 0.7414  1,340.1953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4071160.0002
Check MTime0.00120.1649160.0001
Mysql Total
Database connection0.00060.075210.0006
Mysqli_queries0.694593.6701570.0122
Looping result0.00060.0831550.0000
Template Total0.713896.320.3569
Template load0.00180.244620.0009
Template processing0.712096.036720.3560
Template load and register function0.00010.011710.0001
states
state_id_array0.00080.111910.0008
state_identifier_array0.00110.151220.0006
Override
Cache load0.00150.2006240.0001
Sytem overhead
Fetch class attribute can translate value0.00060.082920.0003
Fetch class attribute name0.00150.203950.0003
XML
Image XML parsing0.00080.111620.0004
class_abstraction
Instantiating content class attribute0.00000.001560.0000
General
dbfile0.00090.1197220.0000
String conversion0.00000.000740.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/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
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.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: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs