A simple Textpattern plugin that produces a link to a file associated with an article, comparable with Textpattern’s <txp:article_image /> tag.
To install go to the ‘plugins’ tab under ‘admin’ and paste the plugin code into the ‘Install plugin’ box, ‘upload’ and then ‘install’. Finally activate the plugin. Please note that you will need to set-up a custom field to use for associating files with articles, unless you choose to embed the new tag in the article text; see the ‘Quick start’ guide below for further details.
Use the following methods after the plug-in has been installed.
Method 1 – recommended
- Define a custom field, ‘Article file’, under preferences.
- Place the tag <txp:arc_article_file /> in a form where you want the download link to appear.
- Associate a file with an article by entering the Textpattern ID of the file, its filename, or its URL into the Article file field.
- Enter <txp:arc_article_file file=“TXP file ID” /> into an article where you want the link to appear setting the file attribute the Textpattern ID of the file associated with the article, its filename, or its URL.
|file||Textpattern’s file ID or filename, or the URL of the file, use if you want to override the custom field||unset||file=“13”|
|link||Set to ‘1’ to link to file, ‘0’ to output filename only||1||link=“0”|
|wraptag||HTML tag to be used as the wraptag, without brackets||unset||wraptag=“p”|
|class||CSS class attribute for wraptag||arc_article_file||class=“download”|
|custom||Name of the custom field containing file IDs associated with article||Article file||custom=“file”|