init_message

Tag {init_message} allows developers to create the detailed message page of a forum. The tag prints out one message.

Parameters

  • id - ID number of the message to return. If ID number is undefined then current page ID is used.
  • name - variable name where the returned data is saved. Default value is "message".
  • 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.
  • 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

Attributes

  • id - ID number of the message
  • parent_id - ID number of parent object.
  • parent_href - link to the upper master level (e.g. messages list).
  • 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.
  • buttons - action-buttons for the message.
  • parent_subject - message's parent subject.
  • parent_subject_id = ID number of the message's parent subject.
  • parent_subject_title = title of the message's parent subject.
  • parent_section = message's parent section (in case message is located directly under the section).
  • parent_section_id = ID number of the message's parent section.
  • parent_section_title = title of the message's parent section.
  • 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. 
  • hit_count - returns page load count of the object. 3.3.1
  • 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 

Examples

{*Detail view of the message*}

{init_message name="obj"}

{* 1st module: Message *}

<h1>{$obj->title}</h1>

    {$obj->body}
    <p>

    {* Show author's e-mail address only if author has allowed it *}
    {if $obj->author_email && $obj->hide_email != '1'}
        <a href="mailto:{$obj->author_email}">{$obj->author}</a>
    {else}
        {$obj->author}
    {/if}

    {$obj->date}
    </p>

{* 2nd module replies to the message *}

    {init_messages name="replies" parent=$obj->id}

    {* Show following only if replies to the message exists *}

    {foreach from=$replies item=reply}

        {$reply->buttons}{$reply->title}<br>
        {$reply->body}<br>

            <p>
                {if $obj->author_email && $obj->hide_email != '1'}
                    <a href="mailto:{$reply->author_email}">{$reply->author}</a>
                {else}
                    {$reply->author}
                {/if}

                {$reply->date}
            </p>

    {foreachelse}
        {$replies_newbutton}
    {/foreach}

{/if}