Jump to content

Template Tag for Current Storage Path


sobrenome

Recommended Posts

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?

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...