init_subjects

Tag {init_subjects} allows developers to create subject (topic) page of a forum. It calls out forum subjects in the current section.

Parameters

  • parent - section ID of current forum. If parent is undefined then current page ID is used.
  • name - variable name where the returned data is saved. Default value is "subject".
  • subjectdetail_tpl - defines the template of subject'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.
  • start - the starting row number to return.3.3.13 3.3.13
  • limit - the number of rows to return. You must use this parameter always with "start" parameter. 
  • 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 subject.
  • detail_href - hyperlink to subject's detailed view.
  • parent_href - hyperlink to the upper level. Commonly used in subject's detailed view.
  • title - subject's title
  • message_count - the number of messages in current subject.
  • started - date of creation of current subject.
  • last_message - date of last message in current subject.
  • buttons - action buttons to edit current subject.
  • 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.

Examples


{* subject list of forum *}

{init_subjects name=subjects"}

 {foreach from=$subjects item=obj}

 <p>
 {$obj->buttons}<a href="{$obj->detail_href}">{$obj->title}</a>
 <a href="{$obj->detail_href}">{$obj->message_count}</a>
 </p>

 {foreachelse}
  {$subjects_newbutton}
 {/foreach}