HFS: Template

From rejetto wiki
Jump to navigation Jump to search

Applying templates from a forum

Download templates from the HFS templates forum.

  1. Open the "Menu" in HFS
  2. Select "Other options" and open "Edit HTML template"
  3. Copy your HTML template and paste it over the HFS "HTML template"

Test your new HTML template by pressing the "apply" button and reload your HFS web page on your web browser.

Building your own HTML template

1. Open the "Menu" in HFS

2. Select "Other options" and open "Edit HTML template"

3. Press the "Help" button to list the available symbols to use in your HTML template.


Template help

HFS builds HTML pages dynamically from the template file hfs.tpl in the hfs.exe folder. If it does not exist, the default template inside hfs.exe will be used.

A template is divided in sections. Each section describes a part of the final HTML page which will be served to the rquesting browser. The template should provide all sections for correct working of the generated HTML. A section usually contains HTML code. Since the final HTML page is built dynamically, symbols have to be used to get valid output. Symbols are surrounded by %percent% characters and define the corresponding sections. A section is labelled using [square brackets]. Symbols will be translated with actual values at run-time. Some symbols return a string for the current variable, while others only get activated if a certain condition is met. Besides symbols, also some defined command line operators can call sections to generate HTML for output.

In the main section, which is unlabeled, and in all other sections, symbols and command line operators can be used to control the HTML output. Some symbols are limited to a specific section. Some symbols will produce the HTML from the corresponding sections, while others just return the corresponding actual string or value.

The best way to build a template is to edit an existing template.

Symbols list - by section

Symbols available in all sections: %connections% current number of connections %style% converts to [style] content %timestamp% current time and date of the server %version% HFS version %uptime% how long HFS has been running without quitting %speed-out% current outward throughput %speed-in% current inward throughput %total-out% total amount of bytes sent %total-in% total amount of bytes received %user% name of the authenticated user, void if no user is logged %loggedin% converts to [loggedin] if a user is logged in, void otherwise %login-link% converts to [login-link] if no user is logged in, void otherwise

Symbols available in the main section: %host% the Host http header field, as sent by the browser %upload-link% converts to [upload-link] if upload is available in the current folders, void otherwise %up% convers to [up] if the current folder is not the root, void otherwise %files% converts to [files] if at least an item is present in the current folder, converts to [nofiles] otherwise %number% number of items in the current folder %number-files% number of files in the current folder %number-folders% number of folders in the current folder %total-size% amount of space occupied by items in the current folder %total-bytes% as %total-size% but expressed in bytes %total-kbytes% as %total-size% but expressed in kilobytes %build-time% how long it took to generate the page Symbols available in [files] %list% the full list of items in the current folder, got by gluing each item after the pertinent section ([file] [folder] or [link]) was converted

Symbols available in [file] [folder] [link] %new% converts to [new] if the file is marked as new, void otherwise %item-url% URL to get the item %item-name% label of the item %item-added% when was the item added to the VFS %comment% converts to [comment] if a comment is available for the item, void otherwise

Symbols available in [file] [folder] %item-dl-count% download counter (virtual folders totalize inner counters) %item-modified% modification time as reported by

Symbols available in [file] %item-size% amount of space occupied by the item %item-size-b% as %item-size% but expressed in bytes %item-size-kb% as %item-size% but expressed in kilobytes Symbols available in [upload] [upload+progress] [upload-results] and main section %diskfree% total amount of available space in the drive containing the current folder (makes sense only for real folders) %folder% path to the current folder %encoded-folder% encoded path to the current folder %parent-folder% encoded path to the parent folder %folder-comment% converts to [folder-comment] if a comment is available for the current folder, void otherwise

Symbols available in [error-page] %content% converts to [ban] [deny] [not found] [unauthorized] [overload], depending on the error

Symbols available in [ban] %reason% ban description

Symbols available in [progress] %progress-files% converts to [progress-nofiles] if no file is transferred with the current client, otherwise the list of transferring files got by gluing each file after the pertinent section ([progress-download-file] or [progress-upload-file]) was converted

Symbols available in [progress-download-file] [progress-upload-file] related to the transferring file %perc% percentage %filename% name of the file %done-bytes% transferred bytes %total-bytes% number of bytes of the complete job %done% as %done-bytes% but using dynamic measure unit %total% as %total-bytes% but using dynamic measure unit %speed-kb% throughput

Symbols available in [upload] %upload-files% input boxes for files to be uploaded got by gluing [upload-file] for each file Symbols available in [upload-file] %idx% ordinal index of the input box

Symbols available in [upload-results] %uploaded-files% list of uploaded files got by gluing [upload-success] or [upload-failed] for each file

Symbols available in [upload-success] [upload-failed] %item-name% name of the file

Symbols available in [upload-success] %item-size% size of the file %speed% avarage speed Symbols available in [upload-failed] %reason% description of error occurred while uploading

________________________________________________________________________________


Sections list

Some of the sections available in template: [up] defines the %up% symbol when there's a parent folder [file] defines a link to a file [folder] defines a link to a folder [link] defines a link to an URL [files] defines the %files% symbol when there's some file [nofiles] defines the %files% symbol when there's no file [comment] defines the %comment% symbol for [file] [folder] and [link] [style] defines the %style% symbol [login-link] defines the %login-link% symbol when no user is logged [loggedin] defines the %loggedin% symbol when the user has logged in [upload-link] defines the %upload-link% symbol when the user has upload rights [up] defines the %up% symbol [folder-comment] defines the %folder-comment% symbol when there's a comment for the current folder [error-page] the frame used for all error pages [overload] defines %content% for the related error-page [unauthorized] " [deny] " [ban] " [not-found] " [max contemporary downloads] " [upload] the upload page [upload-file] form item for a single file [upload-results] the upload results page [newfile] defines the %new% symbol when the item is marked as new