Contributed by Dale Ray
On this page... (hide)
The Multi-Part addon is usually used to add uploading and image handling features to Coranto. But it also adds a special input field that can be configured to read a list of files in a directory and display them as a drop-down box.
On the Edit News Field page in the Coranto interface create a field:
Then edit the settings for the field:
Upload Path is the path to the the directory to pull files from.
Upload Directory is the URL of the directory entered for the path.
The filename could be used in an Apache server include directive. The URL could be used to create a link to the file. Examples:
Extension Mode allows filtering by file extension which files will be displayed in the drop-down box. The choices are:
- Allow only the ones below
- Disallow the ones below
- Allow all file extensions
File Extensions is where the extensions to allow/disallow are entered. Enter the extensions separated by a space.
Specify Upload Field mode is used to set what actions a user can take using this field. For this example set the field to Dropdown box with files from upload path.
This is not a true upload field - users can not add files to the directory you specified. So the available files have to be put there by some other method. The output from one or more Coranto profiles can be placed in the target directory. Then the field will be populated will the current file listing each time an item is submitted or edited.
This could be used for placing sidebar or menu content on page. Page headers or footers could be set using this type of field.
This allows Coranto to be used to create optional content for a section of a page.
Can be used in Coranto styles. Using:
will cause Coranto to substitute the filename (with the extension) in the output. Using
will cause Coranto to substitute the URL of the file.
This style code:
<!--#include virtual="<Field: CustomField_yourField>" -->
Would create a server side include that would cause the server to include the contents of the file you selected using this field.
The driectory has to be specified if the fiel is not n the same directory as the fiel with the include.
<!--#include virtual="/somedir/<Field: CustomField_yourField>" -->
Coranto could be used to edit/create the css files for a site's pages. A field on the input page could read a list of the available files and changing the look of a page simply requires editing the item and changiing which file to use. The CSS file declaration (in the style or template for the page) would look like this:
<link rel="stylesheet" type="text/css" href="style/<Field: CustomField_yourField>" media="screen"/>
Fort a sidebar with three sections: headlines, links, and a fixed note. Three fields could be created using the above method.
A profile that builds the content for each section is created and have each profile builds news in it's own directory. With this directory structure:
- document root
The possible contents would be built into the appropriate directory. Headlines, links and notes that are appropriate to the page can then be selected.
By using discrete directories for each type of item the items presented to the user are relevant to that field.
Upload fields are limited to a single selection.
The number of files available for selection should be limited. This can be done with using filtering by extension, separate build directories, or by another filtering method. If the list gets too long it can be a problem.
The name of the file output by a profile can be set by the user, so unique file extensions can be used to limit the file list. For example: ftr for a footer file, hdr for a header file, lnk for a file of links, etc. The extension to filter on in is set in the field settings.
The drop-down field from a file that is offered by the Custom Fields addon. This field allows multiple selections. Another profile is then needed to build a list of files for it to use. Using the Multi Part upload field makes the creation of the file list dynamic.