{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}
{init_message}
Comments in Saurus CMS are handled by two functions:
- {init_messages} returns a list of parent's child comments.
- {init_message} initializes one comment with given ID.
Comments can be child objects of any type of content, usually for articles, documents and images. In addition, there is a special content type "subject" initialized by {init_subjects} for creating forums.
Usage
{init_message [id = value] [name = value] [parameter = value ..]} Returns
One comment object stored in variable defined by parameter "name".
Parameters
| id | ID of the comment to initialize, usually retrieved by {init_messages} function. When undefined, current ID in URL is used. | int | |
| name | Variable for storing the comment object. Default value is "message". | string | |
| 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 |
Attributes
| Common attributes | |||
|---|---|---|---|
| id | ID of the object. | int | |
| parent_id | ID of the parent object in site hierarchy. | int | |
| parent_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 | |
| body | Message contents. | string | |
| author | Author of the message. | string | |
| author_email | E-mail of the author. | 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 |
| date | Date value in format of dd.mm.yyyy. | date | |
| fdate | Same as "date" attribute but in database format of yyyy-mm-dd | date | |
| datetime | Date and time value in format of dd.mm.yyyy hh:mm. | datetime | 4.4.1 |
| fdatetime | Same as "datetime" attribute but in database format of yyyy-mm-dd hh:mm:ss. | datetime | 4.4.1 |
| 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/topic | |||
| parent_href | Hyperlink to the parent object. | string | |
| parent_subject | Parent object. | object | |
| parent_subject_id | Parent object's ID. | int | |
| parent_subject_title | Parent object's title. | string | |
| 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 |
{init_messages}
Comments in Saurus CMS are handled by two functions:
- {init_messages} returns a list of parent's child comments.
- {init_message} initializes one comment with given ID.
Comments can be child objects of any type of content, usually for articles, documents and images. In addition, there is a special content type "subject" initialized by {init_subjects} for creating forums.
Usage
{init_messages [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 "messages". | string | |
| parent | ID of an object who's child comments 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 | |
| order | Sort order of returned objects. This defines the "order by" clause in SQL sentence, you can use use any fields from tables obj, obj_obj and obj_artikkel. Example: order="date desc". | string | |
| where | Additional filtering criteria for SQL "where" clause. Example: where="title='My headline'". | string | |
| rows_on_page | When defining rows_on_page, you can achieve paging simply by using using "page" parameter in URL. | int | 4.0.8 |
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 | |
| body | Message contents. | string | |
| author | Author of the message. | string | |
| author_email | E-mail of the author. | 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 |
| date | Date value in format of dd.mm.yyyy. | date | |
| fdate | Same as "date" attribute but in database format of yyyy-mm-dd | date | |
| datetime | Date and time value in format of dd.mm.yyyy hh:mm. | datetime | |
| fdatetime | Same as "datetime" attribute but in database format of yyyy-mm-dd hh:mm:ss. | datetime | 4.4.1 |
| 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/topic | |||
| parent_href | Hyperlink to the parent object. | string | |
| message_count | Number of child comments of the parent object. In other words, number of comments in same level. This is generaly used to count comments in current topic. | 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 | |
| <name>_counttotal | Total number of objects found, not affected by "limit" parameter. | int |
