init_objects
3.3.4
Tag {init_objects} returns CMS objects of all existing types (classes). This allows developer to ignore the usual class-based filtering ideology, eg tag {init_section} returns objects with class equal to "section", etc. In general, the class-based filtering using different tags for different objects is more convenient for the developer since most tag parameters and elements are strictly class specific. On the other hand, lots of elements are exactly same for all objects, eg "id", "title", etc.
Parameters
- parent - parent id, which sub-objects will be displayed. If parent is undefined, sub-objects of current page id will be displayed.
- parent_system_alias - finds the system alias which sub-objects will be displayed, this overrides parent parameter. If system alias is not found current page id will be used instead. 4.4.2
- name - defines how {foreach}-loops are called. Deafult value is "objects".
- position - defines the location of objects' list in the page. You can use any numbers for position.
- classes - defines the object types. Possible variables are: "section, article, link, image, comment, poll, document, article's list, link list, login-box, subject, album, iframe-box, event, asset, productcategory".
If not defined all existing classes are returned by default. - buttons - defines which editing buttons are shown to editor. Values can be "new,edit,hide,move,delete".
- start - defines from which object the list will be generated.
- limit - defines how many objects are called out. Useful for optimizing database requests. You must use this parameter always with "start" parameter.
- metadata - defines the metadata ID. Only used when metadata sets exist in a database.
- order - defines how objects are sorted, in descending or ascending order. Sample: order="title desc".
- 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
- select - additional table fields to return using SELECT SQL syntax. 4.1.0
- where - additional filtering criteria using WHERE SQL syntax. 4.1.0
- group - additional table fields to use for grouping using GROUP BY SQL syntax. 4.1.0
Attributes
- id - the id number of the object
- parent_id - ID number of parent object.
- href -the link to object detailed view, e.g. ?id=368. Equals to "details_link".
- title - the title of the object
- is_selected - value in case of active object equals 1, else 0
- buttons - action-buttons, available only for editors.
- details_link - equals to "href"
- details_title - the link title to object detailed view (system string).
- printgif - the link to print view of the object with small printer-icon.
- printlink - the link to print view of the object.
- author - the author of the object
- last_modified - the objects last modified time.
This functionality is deprecated in version 4, please use changed_time instead. - flast_modified - the date of the last modification of the object in format yyyy-mm-dd
This functionality is deprecated in version 4, please use fchanged_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 "N-button" to create new object, in case there are no objects in current parent (and/or position).
- <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. 3.3.7
Example: Show links, articles and polls with class information.
{init_objects name="list" classes="link,article,poll"}
{foreach from=$list item=obj}
{$obj->buttons}{$obj->title} : class="{$obj->class}"<br>
{foreachelse}
{$list_newbutton}
{/foreach}
RSS