Steph A
|
Tuesday 01 March 2005 3:31:05 am
NEWBIE QUESTION I am using the code below now. But then I get ALL of the articles in the subfolders. How can I sort this so that only the 3 most recent articles show? The output now shows the recent articles at the bottom - and I want it on the top.... {* Fetch all subfolders, each representing a news category *}
{let subfolders=fetch( content,
list,
hash( 'parent_node_id', 2,
class_filter_type, include,
depth,3,
class_filter_array, array( 'folder' )
)
)
}
{* For each subfolder, fetch the articles *}
{section loop=$subfolders}
{let articles=fetch( content,
list,
hash( 'parent_node_id', $:item.node_id,
class_filter_type, include,
class_filter_array, array( 'article' )
)
)
}
{* For each article, display the name and the url to the article and the category *}
{section loop=$articles}
{* Use line view to show articles *}
{node_view_gui view=line content_node=$:item}
{/section}
{/let}
{/section}
{/let}
Anybody?
|
Steph A
|
Tuesday 01 March 2005 5:30:31 am
Okay, I tried to use the "sort_by" parameter - but I cant make it work. What am I doing wrong?
{* Fetch all subfolders, each representing a news category *}
{let subfolders=fetch( content,
list,
hash( 'parent_node_id', 2,
class_filter_type, include,
depth,3,
class_filter_array, array( 'folder' )
)
)
}
{* For each subfolder, fetch the articles *}
{section loop=$subfolders}
{let articles=fetch( content,
list,
hash( 'parent_node_id', $:item.node_id,
sort_by, array( array( published, false() ), <------ wrong???
class_filter_type, include,
class_filter_array, array( 'article' )
)
)
}
{* For each article, display the name and the url to the article and the category *}
{section loop=$articles}
{* Use line view to show articles *}
{node_view_gui view=line content_node=$:item}
{/section}
{/let}
{/section}
{/let}
|
luis muñoz
|
Tuesday 01 March 2005 5:52:22 am
try this: Order by priority in the admin and fetch like this in the code
{let news_list=fetch('content','list', hash( parent_node_id, $auxlangnode.node_id, limit, 20, sort_by, array( priority, true() ), class_filter_type, include, class_filter_array, array( 'guide_article' ) ))}
{section name=newsitem loop=$news_list}
|