(2013-05-14, 17:51:49)GPB61 Wrote: Hello,
I would like to return on a question I posed some time ago but which went unanswered.
Is it possible to have a field linking to a document (i.e. pdf) rather than to an image or a slug?
This could be of great importance when setting up catalogs of technical products which often needs of a detailed fact sheet, made available through pdf.
Thanks.
Basically yes (use a text or link field), but there is currently no possibility to select a document - you have to enter the link manually.
But if you take care to use filenames based e.g. on the page slug, you can include them without a field. Just add code like the following to your view code in the special pages setup:
Code:
<?php
global $SITEURL;
$detailsfile = 'products/'.return_page_slug().'_details.pdf';
if (file_exists(GSDATAUPLOADPATH.$detailsfile) {
echo '<a href="'.htmlspecialchars($SITEURL.'data/uploads/'.$detailsfile).'">Details</a>';
}
?>
Edit: Semicolon after echo line added.