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.

eZ debug

Timing: Jan 19 2025 01:01:15
Script start
Timing: Jan 19 2025 01:01:15
Module start 'layout'
Timing: Jan 19 2025 01:01:15
Module start 'content'
Timing: Jan 19 2025 01:01:16
Module end 'content'
Timing: Jan 19 2025 01:01:16
Script end

Main resources:

Total runtime0.9363 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.1797152.6250
Module start 'layout' 0.00630.0037 741.804739.4453
Module start 'content' 0.01000.9244 781.2500543.6406
Module end 'content' 0.93430.0020 1,324.890616.1563
Script end 0.9363  1,341.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3501160.0002
Check MTime0.00130.1425160.0001
Mysql Total
Database connection0.00070.075910.0007
Mysqli_queries0.890395.0799540.0165
Looping result0.00050.0569520.0000
Template Total0.901896.320.4509
Template load0.00210.224120.0010
Template processing0.899796.084720.4498
Template load and register function0.00020.023110.0002
states
state_id_array0.00160.167510.0016
state_identifier_array0.00160.169120.0008
Override
Cache load0.00170.1814130.0001
Sytem overhead
Fetch class attribute can translate value0.00070.077520.0004
Fetch class attribute name0.00130.139730.0004
XML
Image XML parsing0.00070.073920.0003
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00080.0828180.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs