init_file

4.4.0

Tag {init_file} fetches specific file.

Parameters.

  • name - variable name where the returned data is saved. Default value is "file".
  • buttons - defines which action buttons are displayed to the site editor. Values can be "new,edit,hide,move,delete".
  • profile - defines the profile of the files. Value must exactly match the profile name in the site's administration area.
  • icons - relative path to the icons folder, eg "extensions/saurus4/images/file_icons/"

Attributes

  • id - ID number of the file
  • parent_id - ID number of parent object.
  • href - link to the file
  • url - URL to the file
  • title - title of the file
  • buttons - action-buttons, available only for editors.
  • parent - parent folder ID
  • fullpath - absolute path to the file, including filename
  • filename - filename
  • mimetype - MIME type of the file, eg "image/gif"
  • profile_id - profile ID of the file
  • extension - extension of the filename, eg "gif"
  • icon - relative path to file type icon
  • class - class name of the object.
  • date - date of the file
  • fdate - date of the file in database default format, eg yyyy-mm-dd.
  • datetime - date and time of the file, format dd.mm.yyyy hh:mm. 4.4.1
  • fdatetime - date and time of the file in database format, eg yyyy-mm-dd hh:mm:ss. 4.4.1
  • created_user_id - user ID who initially created the object.
  • created_user_name - user full name who initially created the object.
  • changed_user_id - user ID who made the last object saving.
  • changed_user_name - user full name who made the last object saving.
  • created_time - creating time of the object in format dd.mm.yyyy hh:ii.
  • fcreated_time - creating time of the object in database default format, eg yyyy-mm-dd hh:ii.
  • changed_time - last saving time of the object in format dd.mm.yyyy hh:ii.
  • fchanged_time - last saving time of the object in database default format, eg yyyy-mm-dd hh:ii.
  • comment_count - the number of comments.
  • last_commented_time - the last comment time in format dd.mm.yyyy hh:ii.
if the file is an image (determined by mimetype) and is included in a gallery (see init_images) the following attributes become available:
  • thumb_path - relative path to the thumbnail image
  • thumb_height - height of the thumbnail image in pixels
  • thumb_width - width of the thumbnail image in pixels
  • image_path - relative path to the image
  • image_height - height of the image in pixels
  • image_width - width of the image in pixels
  • actual_image_path - relative path to the original image
  • actual_image_height - height of the original image in pixels
  • actual_image_width - width of the original image in pixels
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.

Example:

{init_file name="image" id=12852 icons="extensions/saurus4/images/file_icons/"}

{$image->buttons}
{if $image->extension == 'gif' || $image->extension == 'jpg'}
    <img src="{$image->url}" width="{$image->actual_image_width}" height="{$image->actual_image_width}">
{else}
    <a href="{$image->href}"><img src="{$image->icon}">{$image->title}</a>
{/if}