Author Topic

André R.

Friday 27 February 2009 7:50:50 am

Comment50506

1. Why don't you guys use the rand operator instead, its really simple and you don't end up killing your database bye fetching all node / objects just to shuffle them around in php memory..

example:

{def $max = fetch('content', 'tree_count', hash('parent_node_id', 175))|dec}
      $random_project=fetch('content', 'tree', hash('parent_node_id', 175, 'offset', rand( 0,$max ), 'limit', 1))}

2. Don't expect this to show different content every second and still perform decently, think smart about your cache strategy. But if you really want to get it to change all the time, place it in pagelayout outside any of the cache-blocks (thats better for performance then disabling view-cache)

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom