init_documents
Documents are files which are uploaded to the web server and saved into the database. They can be downloaded by users by clicking on a document link.
Tag {init_document} allows to call out some or all document records within one section. With this tag you can create a page which shows you all documents uploaded into the section.
Parameters
- parent - section ID value(s) from where to get the documents. Multiple ID values must be comma separated. If parent is not defined then current page ID is used.
- name - variable name where the returned data is saved.
- start - the starting row number to return.
- limit - the number of rows to return. You must use this parameter always with "start" parameter.
- position - defines the location of document' list in the page. You can use any numbers for position.
- order - defines how documents are sorted. Articles can be sorted by article title, date or author name with descending or ascending order. Sample: order="title desc".
- 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. - where - additional filtering criteria using WHERE SQL syntax. 3.3.4
- 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 document.
- parent_id - ID number of parent object.
- title - title of the document.
- is_selected - value is 1 in case of active document, 0 otherwise.
- buttons - action-buttons, available only for editors.
- date - date of the document.
- fdate - date of the document in database default format, eg yyyy-mm-dd.
- datetime - date and time of the document, format dd.mm.yyyy hh:mm. 4.4.1
- fdatetime - date and time of the document in database format, eg yyyy-mm-dd hh:mm:ss. 4.4.1
- details_link - hyperlink of the detailed view of the document
- download_link - hyperlink for downloading the document.
- filename - name of the document.
- description - description of the document.
- size - size of the document in bytes.
- size_formated - size of the document in bytes. Formatted.
- mime_type - MIME type of the document.
- author - author of the document.
- last_modified - object's last modified time.
This functionality is deprecated in version 4, please use changed_time instead. - 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.
- <name>_counttotal - the total number of objects found, not affected by "limit" parameter. 3.3.7
Example: Simple document list
{init_documents name="docs"}
{foreach from=$docs item=obj}
{$obj->buttons}
<a href="{$obj->detailed_link}">{$obj->title}</a> Download: (<a href="{$obj->download_link}">{$obj->file}.</a> )
{$obj->date}
{$obj->size_formated}
author:{$obj->author}
description:{$obj->description}
{foreachelse}
{$docs_newbutton}
{/foreach}
RSS