webCOMAND

cTemplate File Directives

There are a number directives to work with files and file data in cTemplate, including specific file types like images, emails, PDFs and Zip archives.

Example

<ul>
#NEW($ZipFile)#FILE(GetContent,'archive.zip')#ENDNEW
#ARCHIVELIST($ZipFile)
    #NEW($Info) #SIZE($Data,StorageLong)#ENDNEW
    #NEW($MimeType)#FILE(GetDataMimeType,$Data)#ENDNEW
    #IF($MimeType =~ /^image\//)
        #APPEND($Info) - #IMAGE($Data,GetWidth)#ENDAPPEND
        #APPEND($Info)x#IMAGE($Data,GetHeight)#ENDAPPEND
    #ELSEIF($MimeType == 'application/pdf')
        #APPEND($Info) - #PDF(GetPageCount, $Data) Pages#ENDAPPEND
    #ENDIF
    <li><a href="#OUTPUT($Filename,$Data)">$Filename</a>$Info</li>
#ENDARCHIVELIST
</ul>