jeremie Posted November 30, 2020 Posted November 30, 2020 Hi, i'm trying to have a random image render for each item of my posts list. so i found this <ul> <?php $items = $pages->find("template=project, Year=$page"); foreach ($items as $item){ echo "<li> <div class='item-inner'> <img src='$item->images->first()->url' width=150px alt='Too Bad'> <div class='overlay'> <a href='$item->url'><h5>$item->title</h5></a> </div> </div> </li>"; } ?> </ul> but i don't understand why it renders me http://localhost:8888/PW3Blank/home/projects/date/2019/bj_-_1.jpg%7Cbj_-_2.jpg%7Cbj_-_3.jpg%7Cbj_-_4.jpg-%3Efirst()-%3Eurl I'm sorry to bother but i can't figure out what i'm doing wrong. thanks for your help
elabx Posted November 30, 2020 Posted November 30, 2020 Try curly braces around the $item->images->first()->url. Actually I don't think this won't really solve the encoding issue haha. ? 1
jeremie Posted November 30, 2020 Author Posted November 30, 2020 it works !!! I don't understand the logic of it but thank you very much
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now