Jump to content

getting random images


jeremie
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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