|
Friday 21 November 2008 5:31:41 pm
Comment50394
No luck at all, I have tryed the following:
{def
$getnodes=fetch('content','list',hash( parent_node_id, $node.node_id,
'class_filter_type', 'include',
'class_filter_array', array( 'modelo_de_producto' ) ) )
$randomno=rand(0,$getnodes|count())
$counter=0
}
How many nodes:{$getnodes|count()}<br />
Random number: {$randomno}<br />
{foreach $getnodes as $child }
{$counter}<br />
{if eq($randomno,$counter)}
{$child.main_node_id}/{$child.name}<br />
{/if}
{def $counter=$counter|inc()}
{/foreach}
1. Fetch all objects of my class 'modelo_de_producto'
2. Def a random number (from 0 to max items fetched) 3. Made a foreach loop and displayed the randomnumber(index) of the array of items fetched Works fine indeed, but never updates to another radomized item, always the same (even is a new session is made in the browser) <b>So far no good.</b> There should be a cache solution that tells "Hey go and run this script whenever y refresh the page" no matter what! Or maybe a javascript that does something like this? Maybe <b>Piotrek Karaś</b> who made a suggestion can give us a tip. I will not refuse to view caching or any caching that will speed upt my site, but on the other hand my client loves the solution of randomized images.
Any clues?
Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com
|