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

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.
Locked
Sendlingur
Forum Members
Forum Members
Posts: 62
Joined: Wed Aug 08, 2018 4:59 pm

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

Post 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?
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post by Rolf »

Code: Select all

{assign var='pics' value="uploads/images/{$entry->Picfolder}/*.jpg"}
double quotes!
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Sendlingur
Forum Members
Forum Members
Posts: 62
Joined: Wed Aug 08, 2018 4:59 pm

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

Post 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?
Sendlingur
Forum Members
Forum Members
Posts: 62
Joined: Wed Aug 08, 2018 4:59 pm

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

Post by Sendlingur »

I figured it out , I had to add " |glob " to the end of the string.

thanks again Rolf for pointing out the "".
Locked

Return to “CMSMS Core”