Wednesday 23 June 2004 1:49:08 am
Hi there, Was a bit optimistic with the scroller - it works in Opera and Mozilla but not in IE as IE is less forgiving with the javascript... Result is need to refine the code a little. The problem I have, taking the code that generates the data for the latest news listing, is this:
{section show=or($show_subtree|count_chars()|eq(0), $requested_uri_string|begins_with( $show_subtree ))}
{section show=$sort_by|count|eq( 0 )}{set sort_by='published'}{/section}
{let node_list=cond( $treelist_check|eq( 'yes' ),
fetch( content, tree, hash( parent_node_id, $parent_node,
limit, $limit,
class_filter_type, exclude,
class_filter_array, array( 'folder' ),
sort_by, array( $sort_by, false() ) ) ),
fetch( content, list, hash( parent_node_id, $parent_node,
limit, $limit,
class_filter_type, exclude,
class_filter_array, array( 'folder' ), sort_by, array( $sort_by, false() ) ) ) )}
{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
{node_view_gui view=listitem content_node=$Node:item}
{/section}
{/let} {/section} If you take the line: {node_view_gui view=listitem content_node=$Node:item} I need to put in a 'if...then' statement on the lines of "add the character ',' at the end of each line, unless this is the last loop in the array, in which case add nothing" Something on the lines of: $var = max value of the loop
{node_view_gui view=listitem content_node=$Node:item} {section name=lastarray show=$var}
{section-else}
, {/section} So, a comma is all that stands between me and good java code ;) A less elegant work around would be assume you always have enough news articles so that you utilise the '{default limit=5}' and dont add the comma on the 5th loop - this would be easier to code but creates a less robust scrolling news template. Any pointers on thsi would be most welcome. Thanks, Steve.
http://www.oneworldmarket.co.uk
|