Monday 13 November 2006 10:14:58 am
Hi,
yes, in an image template, there is an prev / next code, but it contains a bug: http://issues.ez.no/IssueView.php?Id=9160&activeItem=6 design/base/templates/override/full/image.tpl It is working if you don't sort the items in the folder by name. If you need to sort the items by name, there is a workaround:
{def $content_list=fetch( content, list, hash( parent_node_id, $node.parent_node_id,
sort_by, $node.parent.sort_array ) )
$current_pos=0
$previous_image=false()
$next_image=false()
$content_count=$content_list|count}
{foreach $content_list as $key => $item}
{if eq($item.node_id,$node.node_id)}{set $current_pos=$key}{/if}
{/foreach}
{if $content_count|gt(1)}
{if $current_pos|gt(0)}{set $previous_image=array($content_list[sub($current_pos,1)])}{else}{set $previous_image=array($content_list[sub($content_count,1)])}{/if}
{if sum($current_pos,1)|lt($content_count)}{set $next_image=array($content_list[sum($current_pos,1)])}{else}{set $next_image=array($content_list[0])}{/if}
{/if}
But this code isn't good because you need to fetch each element in the list to find out which is previous and which is next. Hope that helps.
Best wishes,
Georg.
--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004
|