Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
sobrenome Posted August 7, 2015 Posted August 7, 2015 I am making a custom template for database records and one of the fields is "upload" with "allow multiple uploads".The uploads are basic images and I am manipulating the content items to use the LightBox.I could not find a template tag (https://community.invisionpower.com/4docs/advanced-usage/development/template-tags-r76/) to give me the path to the current storage in my system.I do not want to use a fixed path in my template like "www.mysite.com/forum/uploads" because I may want to use CDN or Amazon S3 in the future and I would have to manually change all the templates of all databases that use the field "upload".So, how to get dynamically the path to the current storage settings?
Ralf Herrmann Posted August 7, 2015 Posted August 7, 2015 To dynamically construct the absolute file URL in a template you would use:{file="$the-file-name" extension="the-extension-identifier"}In a Pages template this would then look like this:{file="$record->record_image" extension="cms_Records"}
sobrenome Posted August 20, 2015 Author Posted August 20, 2015 Hello @Ralf Herrmann! I am dealing with an upload field with multiple uploads. The content of the filed is many images with paths separated by commas, like: "/forum/uploads/monthly_04_2011/image_name_01.jpg,/forum/uploads/monthly_04_2011/image_name_02.jpg,/forum/uploads/monthly_04_2011/image_name_03.jpg".In the database record template I want to show this images, but I do not want to use a fixed path, I want to dynamically generate the path, in the case I decide to change the storage settings or use a CDN.But how to use {file="$the-file-name" extension="the-extension-identifier"}in this case?I know that I can do this:{{$images = explode(",", $record->customFieldDisplayByKey('key_name'));}}But I do not know how to get only the "$the-file-name"to generate dynamically the path for the file.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.