From GruppoZenit
Jump to: navigation, search

Zcms:filedownload tags are used to download files securely from zcms contentmodels.

Attribute Definition
filename The filename encrypted using zcms:encrypt tag.
auth The possible values are "true" or "false" and default is "false".

if auth is set to true.the file can be downloaded onlyif an authorised user is logged in.

redirecturl Will be redirect to a webpage if attribute "auth" value is "true" and an authorised user is not logged in. [Redirection path works only inside the context]
filetype Specifies the content attribute type
  1. MEDIA - if content attribute type is media
  2. DOCUMENT - if content attribute type is document

Example on how to use the zcms:filedownload tag:

<zcms:content name="draft_files">
   <zcms:datacolumn name="doc" alias="doc"/>
   <zcms:store var="doc" attribute="doc"/>
   <zcms:datacolumn name="med" alias="med"/>
   <zcms:store var="med" attribute="med"/>

<zcms:encrypt var="encryptdoc">
   <zcms:param name="param1" value="[zcms:use:doc]"/>
<zcms:encrypt var="encryptmed">
   <zcms:param name="param1" value="[zcms:use:med]"/>

download document of type media
<zcms:filedownload filename="[zcms:use:encryptdoc]" filetype="DOCUMENT"><a href="#">download</a></zcms:filedownload>

<br/>download document of type document after checking user authentication,if fails redirect to page loginerror
<zcms:filedownload filename="[zcms:use:encryptmed]" filetype="MEDIA" auth="true" redirecturl="/loginerror">
   <a href="#">download</a>

See also

Personal tools