Monday 26 May 2003 3:07:31 pm
This is the code that i ended up using to use a fetch function grab the latest articles published to a specific node and navigate them using the google navigator. Let me know if it works for you.
{* set the top node from which to generate pages *} {let topnode=24}
{* set the parrent node from which to grab content *} {let theparent=158}
{* set number of items per page *} {let page_limit=20}
{* get total number of articles*} {let item_count=fetch('content','list_count', hash('parent_node_id',$theparent,'class_filter_array',array(2),'class_filter_type','include','depth', 0))}
{* if its not the first page, show page X of X *}
{section show=ne($view_parameters.offset,0)}
<b>Page {sum($view_parameters.offset,1)} of {round(div($item_count,$page_limit))}</b><br> {/section}
{* grab and loop the news content *} {section name=news loop=fetch('content','list', hash(parent_node_id, $theparent, limit, $page_limit, offset,mul($view_parameters.offset,$page_limit), class_filter_type, "include", class_filter_array, array(2), "sort_by", array("published", false()), "depth", 0))}
{* print the date *} {$news:item.object.published|datetime(custom,"%M %d, %Y")}
{* print a url and title of article *} <a href={concat("/content/view/full/",$news:item.node_id)|ezurl}>{attribute_view_gui attribute=$news:item.data_map.pagetitle}</a>
{* end grab and loop *} {/section}
<b>Go to page:</b>
{include name=navigator
uri='design:navigator/google.tpl'
page_uri=concat('/content/view','/full/',$topnode)
item_count=div($item_count,$page_limit)
view_parameters=$view_parameters item_limit=$view_parameters}
{/let}
{/let}
{/let} {/let}
|