| Wednesday 10 October 2007 2:18:23 am 
                                                                 Hi, As André mentioned, you need to fetch forum messages sorted on modified_subnode. Here's the code we use to generate the Latest forum activity on ez.no/developer. 
{let forum_list=fetch_alias( lastest_forum_replies, hash( parent_node_id, 308 ) )}
{section show=$forum_list}
    <ul class="linklist">
        {section loop=$forum_list}
            {let last_reply_array=fetch_alias( last_forum_reply, hash( parent_node_id, $:item.node_id ))
                 last_reply=$last_reply_array.0}
            <li>
                {section show=$:last_reply}
                    {node_view_gui view=listitem content_node=$:last_reply show_extra_info=true()}
                {section-else}
                    {node_view_gui view=listitem content_node=$:item show_extra_info=true()}
                {/section}
            </li>
            {/let}
        {/section}
        </ul>
{/section}
{/let}
- lastest_forum_replies is defined as following: [lastest_forum_replies]
Module=content
FunctionName=tree
Parameter[parent_node_id]=parent_node_id
Constant[sort_by]=modified_subnode;0
Constant[depth]=2
Constant[limit]=10
Constant[class_filter_type]=include
Constant[class_filter_array]=forum_message - last_forum_reply is defined like this: [last_forum_reply]
Module=content
FunctionName=list
Parameter[parent_node_id]=parent_node_id
Constant[sort_by]=published;0
Constant[limit]=1
Constant[class_filter_type]=include
Constant[class_filter_array]=forum_message Here's the listitem view for the forum message: {* List item for form message *}
{* Parameters:
   - show_extra_info = Boolean true(), false()
     Shows extra info such as date, author and number of replies.
     Typicaly used by the community frontpage.
     Default is false()
*}
<div class="content-view-list">
<div class="class-forummessage">
{def $post_count_html=""}
{if $node.parent.object.contentclass_id|eq( 14 )}
    {def $offset=0
         $post_count=$node.parent.children_count}
    
    {if $show_extra_info}
        {set $post_count_html=concat(' <span class="forum-replies">(', $post_count, ')</span>' )}
    {/if}
    {include uri="design:parts/forum/calc_offset.tpl" count=$post_count}
    {if $offset|le( 0 )}
        <h3><a title="Posted by: {$node.object.owner.name}: {$node.data_map.message.content|wash|shorten( 400 )}" href={concat( $node.parent.url_alias, '#msg', $node.node_id )|ezurl}>{$node.parent.name|wash}</a>{$post_count_html}</h3>
    {else}
        <h3><a title="Posted by: {$node.object.owner.name}: {$node.data_map.message.content|wash|shorten( 400 )}" href={concat( $node.parent.url_alias, '/(offset)/', $offset, '/#msg', $node.node_id )|ezurl}>{$node.parent.name|wash}</a>{$post_count_html}</h3>
    {/if}
{else}
    {if $show_extra_info}
        {set $post_count_html=' <span class="forum-replies">(0)</span>'}
    {/if}
    
    <h3><a title="Posted by: {$node.object.owner.name}: {$node.data_map.message.content|wash|shorten( 400 )}" href={concat( $node.url_alias, '#msg', $node.node_id )|ezurl}>{$node.name|wash}</a>{$post_count_html}</h3>
{/if}
{if $show_extra_info}
    <div class="attribute-byline float-break">
        <p class="date">{$node.object.published|l10n( 'shortdatetime' )}</p>
        <p class="author">{$node.object.owner.name}</p>
    </div>
{/if}
</div>
</div>
and finally the "calc_offset.tpl" template which does just that, calculate the offset. {set offset=$count|div( 20 )|ceil()|sub( 1 )|mul( 20 )}
Make sure you add an unique anchor each of your forum messages when viewing a thread. The {$node.node_id} is perfect for that.I hope this helps :)
 Senior Software Engineer - Vision with Technology
 http://www.visionwt.com
 http://www.omh.cc
 http://www.twitter.com/omh
 
 eZ Certified Developer
 http://ez.no/certification/verify/358441
 http://ez.no/certification/verify/272578
 |