{init_object}

Tag {init_object} returns one CMS object of any type (class). Tag will load entire contents of the object and return info as elements. Element listing depends on the class where the current object belongs, for example document object has different elements than article object. Detailed information about article's elements can be found on SAPI reference page for {init_article}, about document's elements on page {init_document}, etc.

 Parameters

  • id - ID number of the object to return
  • name -  variable name where the returned data is saved. Default value is "object".
  • buttons - defines which action buttons are displayed to the site editor. Values can be "new,edit,hide,move,delete".

Attributes

  • id - ID number of the object.
  • parent_id - ID number of parent object.
  • href - link to the object detailed view, e.g. ?id= 368.
  • title - title of the object.
  • class - class name of the object.
  • buttons - action-buttons, available only for editors.
  • details_link - alias for attribute "href" (deprecated).
  • details_title - link title to the object detailed view (system word) (deprecated).
  • printgif - link to the print view of the object with small printer-icon (deprecated).
  • printlink - link to the print view of the object (deprecated).
  • <attribute> - attribute value for object, attribute name can be any information field existing for current class.
  • 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

Additional attributes for section (3.3.174.0.7 ):

  • show_toolicons - 1 - if tools icons are visible, 0 - otherwise.
  • is_mailinglist - 1 - if section is included in mailinglist, 0 - otherwise.
  • show_subarticles - 1 - if subarticles are visible, 0 - otherwise.
  • is_hided_in_menu - 1 - if section is hided in navigation menu, 0 - otherwise.
  • show_date - 1 - if date is visible for articles, 0 - otherwise.

Additional attributes for album (4.5.3):

  • title - album title.
  • description - description of the album.
  • thumbnail_size - size of thumbnail images, in pixels.
  • image_size - size of images, in pixels.
  • folder_id - images source folder ID.
  • folder_path - images source folder path, eg "public/images".

Additional attributes for poll:

  • is_open - 1 - if poll is not in archive, 0 - otherwise.
  • is_voted - 1 - if user is voted, , 0 - otherwise.
  • answers_count - the count of all poll's answers.
  • answers - array of answers having elements:
    "->answer" (same as "->title")
    "->count"
  • voters - array of voters having elements:
    "->id"
    "->answer_id"
    "->ip"
    "->user_id"
    "->user_firstname"
    "->user_lastname"
    "->time"
    "->ftime"

    Sample code for Polls

init_objects

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_sections} 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 value(s) which sub-objects will be displayed. Multiple ID values must be comma separated. 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}