Jump to content

image->url in foreach loop produces error


thomasaull
 Share

Recommended Posts

Hey guys,

I'm having a problem when I want to output images of my portfolio in a foreach loop, this is my code:

foreach($page->child("name=works")->children() as $i => $work) 
{
	echo $work->single_image->url
}

even tough the code outputs the proper path I get the following error:

Notice: Trying to get property of non-object in /Users/thomasaull/Websites/www.thomass-imac.local:5757/site/templates/work-study.php on line 33

My page structure is basically

Portolio

-- Works

---- Work01

---- Work02

Any help is highly appreciated :)

Best,

Thomas

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...