I have a channel set up to store policy PDF documents. So - I have an entry say for ‘health and safety policy’ and a couple of bits of info, then I have a File field where the PDF can be uploaded and stored to a /uploads/policies folder.
All works fine, but I’d like to add search. I struggling to point the path correctly to the uploaded file. If I use {auto_path} then I don’t get the path to the PDF.
{exp:search:search_results}
<a href="http://{auto_path}">{title}</a>
{/exp:search:search_results}I have made it work for a single channel by hard coding the Search Results URL in the Channel settings to the upload folder, and then using the {policy_document} field name instead of auto_path, but I need this to work across a number of channels with a number of different document fieldnames so this isn’t a good fix.
How can I make the {auto_path} return the correct full link to the PDF document?
Cheers!
You can’t…;) Or at least not without hacking some core files. Auto path is intended to be just a path to an EE template, not a specific file.
You’re going to have to build your own links in the search results. I’d be looking at some channel/fieldname naming schema that you could then use to dynamically build the link on the results page.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.