{init_subjects}
Subjects are objects which let you create topics to build forums.
Usage
{init_subjects [name = value] [parent = value ] [parameter = value ..]}
Returns
Array of objects stored in variable defined by parameter "name".
Parameters
| name | Defines the variable which stores the list of article objects returned. Default value is "subject". | string | |
| parent | ID of an object who's child subjects are retrieved. Default value is the current object's ID which is usually the ID parameter in site URL. You can also define multiple ID-s by comma separating them. | comma separated integers | |
| on_create | Enables you to set default values when new comment is created. | comma separated string | |
| publish: By default, objects are set to be hidden/unpublished when created by user. You can force publishing by using on_create="publish". Default value is "hide". | 4.0.2 | ||
| limit | This lets you limit the number of database rows to return. | int | |
| start | Results are retrieved starting from first row by default. You can set any other number to achieve paging for example. You must also define parameter "limit" when using "start". Default value is 0. | int |
Attributes
| Common attributes | |||
|---|---|---|---|
| id | ID of the object. | int | |
| parent_id | ID of the parent object in site hierarchy. | int | |
| detail_href | Hyperlink address to the object in format of ?id=123. When aliases are used, returns alias name in public view instead. | string | |
| buttons | Displays v-shaped context menu for authorized editors. | html | |
| title | Title of the object. | string | |
| comment_count | Number of direct child comments. | int | 4.0.6 |
| last_commented_time | Time of last direct child comment in format of dd.mm.yyyy hh:ii. | datetime | 4.0.6 |
| class | Class name of the object. Possible values are: "section, article, link, image, comment, poll, document, article's list, link list, login-box, subject, album, iframe-box, event" | string | |
| Parent | |||
| parent_href | Hyperlink to the parent object. | string | |
| message_count | Number of child comments. | int | |
| Author and timestamp | |||
| created_time | Time of creation of the object in format of dd.mm.yyyy hh:ii. | datetime | 4.0.3 |
| fcreated_time | Time of creation of the object in database default format, eg yyyy-mm-dd hh:ii. | datetime | 4.0.3 |
| created_user_id | ID of the user who initially created the object. | int | 4.0.3 |
| created_user_name | Name of the user who initially created the object. | string | 4.0.3 |
| changed_time | Time of last saving of the object in format dd.mm.yyyy hh:ii. | datetime | 4.0.3 |
| fchanged_time | Time of last saving of the object in database default format, eg yyyy-mm-dd hh:ii. | datetime | 4.0.3 |
| changed_user_id | ID of the user who saved the object last. | int | 4.0.3 |
| changed_user_name | Name of the user who saved the object last. | string | 4.0.3 |
General tags
| <name>_newbutton | Outputs action button for creating new object. | html | |
| <name>_count | Number of returned objects. When parameter "limit" is set, equals value of "limit". | int |
Example
{init_subjects name="subjects"}
{foreach from=$subjects item="subject"}
<p>{$subject->buttons}<a href="{$subject->detail_href}">{$subject->title}</a> {$subject->message_count}</p>
{foreachelse}
{$subjects_newbutton}
{/foreach}
