Page 1 of 1

using {$entry->Picfolder} in an {assign} not working?

Posted: Wed Oct 09, 2019 11:51 am
by Sendlingur
I'm trying to access a folder which contains images.
The user inserts the name of the folder to a custom field in the News module.

In the news detail template I have this to loop through the images in the folder.
But for some reason that I haven't figured out it is like the path doesn't get assigned to the pics variable.

Code: Select all

 
{assign var='pics' value='uploads/images/{$entry->Picfolder}/*.jpg'}
     {foreach from=$pics item='pic'}
         <div><img src='{root_url}/{$pic}' width='600' height='600' alt='' /></div>
      {/foreach}
can someone please advise me on this?

Re: using {$entry->Picfolder} in an {assign} not working?

Posted: Wed Oct 09, 2019 11:57 am
by Rolf

Code: Select all

{assign var='pics' value="uploads/images/{$entry->Picfolder}/*.jpg"}
double quotes!

Re: using {$entry->Picfolder} in an {assign} not working?

Posted: Wed Oct 09, 2019 1:10 pm
by Sendlingur
Thanks Rolf of course it is double quotes :). The path is right now. But for some reason it looks like this
<img src="https://mypage.com/uploads/images/projectx/*.jpg" width="600" height="600" alt="">

it is reading the jpg as " *.jpg ".

Why is that?

Re: using {$entry->Picfolder} in an {assign} not working?

Posted: Wed Oct 09, 2019 1:38 pm
by Sendlingur
I figured it out , I had to add " |glob " to the end of the string.

thanks again Rolf for pointing out the "".