Forums / Setup & design / Suffle operator - Link on the image randomly selected
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 X
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}>
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>