Forums / Setup & design / How to accomplish with this? Any Ideas?

How to accomplish with this? Any Ideas?

Author Message

Jerry Jalava

Tuesday 01 July 2003 4:07:13 pm

I need to get newest articles from five specific folders (witch are the categories) and showing only 3 newest articles (No matter in witch category they are)...

The structure:
- Category 1 (Folder)
- Article 1
- Article 2
- Category 2 (Folder)
- Article 1
- Article 2
etc...

If the Category 1's both articles have been published before Category 2's article 2, then I only need to show the Article 1,2 from category 1 and article 1 from category 2...

This is only part of something bigger I'm building put this is something I just can't get to work...

And other problem comes, when I have tens of categories... I need to make a page where I show only one newest article of each category and I need to limit it to 5 categories and articles per page and use navigator for pages...

I found this code from the forums and used it to accomplish the first part of the other problem: "How to show one newest article in each category"...

This is the code I used:
"Top_cat" is the folders id that keeps inside the categories (folders).

{let top_cat=16 used_node=false()}

{section show=is_set($DesignKeys:used.node)}
{set used_node=$DesignKeys:used.node}
{section-else}
{set used_node=$top_cat}
{/section}

{let node_obj=fetch(content,node,hash(node_id,$used_node))}

{section loop=fetch(content,list,hash(parent_node_id,$top_cat,class_filter_type,"include",class_filter_array,array(1),sort_by,array(array(priority))))}
<table width="240" border="0"><tr><td><a class="path" href={$:item.url_alias|ezurl}>{$:item.name}</a></td></tr></table>

{section loop=fetch(content,list,hash(parent_node_id,$:item.node_id,limit,1,class_filter_type,"include",class_filter_array,array(2),sort_by,array(published,false())))}
<table width="240" border="0"><tr><td><a class="path" href={$:item.url_alias|ezurl}>{$:item.name}</a></td></tr></table>

{/section}
{/section}
{/let}
{/let}

Any suggestions are welcome

Thanks already,
Jerry

P.S. I hope even someone understood what I was trying to explain... ;)