“top” parameter in {cms_filepicker} changes output path? Topic is solved

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
10010110
Translator
Translator
Posts: 217
Joined: Tue Jan 22, 2008 9:57 am

“top” parameter in {cms_filepicker} changes output path?

Post by 10010110 »

So, I have hero images in a directory called “hero” inside the uploads directory. I’m using this template tag:

Code: Select all

{content_module module='ECB2' block='filepicker' field='file_picker' top='hero' assign='hero'}
Since ECB2 is just extending the default FilePicker module, I can use the “top” parameter of {cms_filepicker} to specify a top directory, and this works on the admin side but the output of that tag doesn’t seem to take that into account. If I echo

Code: Select all

{$hero}
I’m just getting the file name, no path prepended. If I leave the top parameter out I can/have to change the directories while selecting a file and then it prints the proper file path with parent directories. Am I missing something? I would assume it should always print the complete file path relative to the uploads directory and the top parameter only specifies the topmost browsable directory in admin?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1632
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: “top” parameter in {cms_filepicker} changes output path?

Post by DIGI3 »

Using a filepicker profile or the top parameter will cause the ECB2 tag to only store the path and filename relative to that profile or top directory. It assumes you know the path you defined in the tag, so you also use that path in your templates to display the file.
e.g. if you use

Code: Select all

{content_module module=ECB2 field=file_picker block=test assign=tempfile top='foobar'}
Your template would be something like

Code: Select all

<img src="{uploads_url}/foobar/{$tempfile}">
Not getting the answer you need? CMSMS support options
10010110
Translator
Translator
Posts: 217
Joined: Tue Jan 22, 2008 9:57 am

Re: “top” parameter in {cms_filepicker} changes output path?

Post by 10010110 »

Thanks for the quick answer. :)
Post Reply

Return to “CMSMS Core”