Create a list of replies in forum

Author Message

Ole Brudvik

Thursday 14 April 2005 5:41:08 am

Hi

Im trying to create a list of replies to a topic. Cant figure out how to do it.

I want the list to appear in the right colon:
http://singteach.nie.edu.sg/index.php/singteach/forum/teacher_work_attachment

This is my kode:

{let topic_list=fetch('content','list',hash( parent_node_id, $node.node_id,
                                             limit, 20,
                                             offset, $view_parameters.offset,
                                             sort_by, array( array( attribute, false(), 'forum_topic/sticky' ), array( 'modified_subnode', false() ) ) ) )
     topic_count=fetch('content','list_count',hash(parent_node_id,$node.node_id))}
<div class="categoryheading">Forum</div><p>
<div class="articleheading">
 

    {$node.name|wash}

</div>
<p>
    <div class="contentgreybig">
    {attribute_view_gui attribute=$node.object.data_map.description}
    </div>
</p>

    {section show=is_unset( $versionview_mode )}
    {section show=$node.object.can_create}
        <form method="post" action={"content/action/"|ezurl}>
            <input class="enter" type="submit" name="NewButton" value="{'New topic'|i18n( 'design/base' )}" />
            <input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
            <input type="hidden" name="ContentObjectID" value="{$node.contentobject_id.}" />
            <input class="enter" type="submit" name="ActionAddToNotification" value="{'Keep me updated'|i18n( 'design/base' )}" />
            <input type="hidden" name="NodeID" value="{$node.node_id}" />
            <input type="hidden" name="ClassIdentifier" value="forum_topic" />
        </form>
    {section-else}
        <p>  <div class="contentorangebold">
        {"You need to be logged in to participate in the forums. You can do so %login_link_start%here%login_link_end%"|i18n( "design/base",,
         hash( '%login_link_start%', concat( '<a href=', '/user/login/'|ezurl, '>' ), '%login_link_end%', '</a>' ) )}
       </div><br> </p>
    {/section}
    {/section}


    <div class="topics">

        <table class="listforum" align="center" cellspacing="0" border="1">
        <tr class="forumcell">
            <td width="35%" class="topics">
                {"Topic"|i18n( "design/base" )}
            </td>
            <td width="20%" class="topics">
                {"Total Replies"|i18n( "design/base" )}
            </td>
            <td width="22%" class="topics">
                {"Author"|i18n( "design/base" )}
            </td>
            <td width="22%" class="topics">
                {"Replies"|i18n( "design/base" )}
            </td>
        </tr>

        {section var=topic loop=$topic_list sequence=array( bglight, bgdark )}
        {let topic_reply_count=fetch( 'content', 'tree_count', hash( parent_node_id, $topic.node_id ) )
             topic_reply_pages=sum( int( div( sum( $topic_reply_count, 1 ), 20 ) ), cond( mod( sum( topic_reply_count, 1 ), 20 )|gt( 0 ), 1, 0 ) )}
        <tr class="tc">
            <td class="contentorange2">

                {$topic.object.name|wash}</p>
                {section show=$topic_reply_count|gt( sub( 20, 1 ) )}
                    <p>
                    {'Pages'|i18n( 'design/base' )}:
                    {section show=$topic_reply_pages|gt( 5 )}
                        <a href={$topic.url_alias|ezurl}>1</a>...
                        {section var=reply_page loop=$topic_reply_pages offset=sub( $topic_reply_pages, sub( 5, 1 ) )}
                            <a href={concat( $topic.url_alias, '/(offset)/', mul( sub( $reply_page, 1 ), 20 ) )|ezurl}>{$reply_page}</a>
                        {/section}
                    {section-else}
                        <a href={$topic.url_alias|ezurl}>1</a>
                        {section var=reply_page loop=$topic_reply_pages offset=1}
                            <a href={concat( $topic.url_alias, '/(offset)/', mul( sub( $reply_page, 1 ), 20 ) )|ezurl}>{$reply_page}</a>
                        {/section}
                    {/section}
                    </p>
                {/section}
            </td>
            <td class="replies">
                <p>{$topic_reply_count}</p>
            </td>
            <td class="author">
                <div class="attribute-byline">
                   <p class="date">{$topic.object.published|l10n(shortdatetime)}</p>
                   <p class="author">{$topic.object.owner.name|wash}</p>
                </div>
            </td>
            <td class="listforumalignleft">
            {let last_reply=fetch('content','list',hash( parent_node_id, $topic.node_id,
                                                         sort_by, array( array( 'published', false() ) ),
                                                         limit, 1 ) )}
                {section var=reply loop=$last_reply show=$last_reply}
                <div class="attribute-byline">
                   <p class="date">{$reply.object.published|l10n(shortdatetime)}</p>
                   <p class="author">{$reply.object.owner.name|wash}</p>
                </div>
                {section show=$topic_reply_count|gt( 19 )}
                    <p><a href={concat( $reply.parent.url_alias, '/(offset)/', sub( $topic_reply_count, mod( $topic_reply_count, 20 ) ) , '#msg', $reply.node_id )|ezurl}>{$reply.name|wash}</a></p>
                {section-else}
                    <p><a href={concat( $reply.parent.url_alias, '#msg', $reply.node_id )|ezurl}>{$reply.name|wash}</a></p>
                {/section}
                {/section}
           {/let}
           </td>
        </tr>
        {/let}
        {/section}
        </table>

    </div>

    </div>
</div>
{include name=navigator
         uri='design:navigator/google.tpl'
         page_uri=concat('/content/view','/full/',$node.node_id)
         item_count=$topic_count
         view_parameters=$view_parameters
         item_limit=20}

{/let}

Ɓukasz Serwatka

Friday 15 April 2005 1:49:15 am

See

http://ez.no/community/forum/setup_design/setting_up_forum_and_the_templates#msg73066

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.