init_messages

Tag {init_messages} allows developers to create the forum page for a subject. It prints out the messages for the current subject.

 Parameters

  • parent - section ID value(s) of current forum. Multiple ID values must be comma separated. If parent is undefined then current page's ID is used.
  • name - variable name where the returned data is saved. Default value is "messages".
  • messagedetail_tpl - defines the template of messages's detailed view.
  • metadata - defines the metadata ID. Only used when metadata sets exist in a database.
    This functionality is deprecated in version 4 , please use profiles instead.
  • order - defines how messages are sorted, in descending or ascending order. Sample: order= "title desc". Default order value is: "time DESC, object_id DESC".
  • where additional filtering criteria using WHERE SQL syntax.
  • start -the starting row number to return. 3.3.9
  • limit - the number of rows to return. You must use this parameter always with "start" parameter. Default value for limit is configuration value "Number of comments on 1 comments page" (usually 20), which can be changed on admin-page "System > Configuration". 3.3.9
  • on_create - allows to publish all objects immediately. If the parameter has value "on_create=publish", then a created object is published immediately. Default value is "hide". 4.0.2
  • rows_on_page - how many rows to display on one page. Used with URL "page" parameter. 4.0.8.

 Attributes

  • id - ID number of message.
  • parent_id - ID number of parent object.
  • detail_href - hyperlink to the detailed view of the message.
  • parent_href - hyperlink to the master level (subject).
  • title - title of the message.
  • body - body text of the message.
  • date - the date of the message.
  • fdate - the date of the message in database format yyyy-mm-dd
  • datetime - date and time of the message format dd.mm.yyyy hh:mm. 4.4.1
  • fdatetime - date and time of the message in database format, eg yyyy-mm-dd hh:mm:ss. 4.4.1
  • author - author of the message.
  • author_email - e-mail of the message's author.
  • message_replies - the number of replies to the message.
  • message_count - the number of messages in the current subject.
  • started - creating date of the current subject.
  • last_message - date of the last message in the current subject.
  • buttons - action-buttons for the message.
  • last_modified - the objects last modified time.
    This functionality is deprecated in version 4, please use changed_time instead.
  • class - class name of the object.
  • created_user_id - user ID who initially created the object. 4.0.3
  • created_user_name - user full name who initially created the object. 4.0.3
  • changed_user_id - user ID who made the last object saving. 4.0.3
  • changed_user_name - user full name who made the last object saving. 4.0.3
  • created_time - creating time of the object in format dd.mm.yyyy hh:ii. 4.0.3
  • fcreated_time - creating time of the object in database default format, eg yyyy-mm-dd hh:ii. 4.0.3
  • changed_time - last saving time of the object in format dd.mm.yyyy hh:ii. 4.0.3
  • fchanged_time - last saving time of the object in database default format, eg yyyy-mm-dd hh:ii. 4.0.3
  • comment_count - the number of comments. 4.0.6 
  • last_commented_time - the last comment time in format dd.mm.yyyy hh:ii. 4.0.6

General tags

  • <name>_newbutton - prints "New" action-button for creating a new object.
  • <name>_count - the number of returned objects. If parameter "limit" is set then count equals to "limit" value.
  • <name>_counttotal - the total number of objects found, not affected by "limit" parameter. 

 Examples

{* Search for messages within current subject. *}

{init_messages name="messages"}

    {foreach from=$messages item=obj}

        {$obj->buttons} <href="{$obj->detail_href}">{$obj->title}</a>
        {$obj->body} {if $obj->message_replies == 0}
        <href="{$obj->detail_href}">Reply to this message</a> {else}
        Replies: <href="{$obj->detail_href}">{$obj->message_replies}</a> {/if} 

    {/foreach}