This works perfectly fine on all pages except the home page.
Using the same method, I’m getting a “Call to a member function toFile() on null” error message for all my images there.
I already confirmed that the correct filenames are indeed stored in the home.txt file:
myImage:
-image.jpg
All other contents are properly rendered, it’s just with the images on the home page that I’m getting this error.
Thanks for the quick reply! Sorry about the quote; first post on the forums! ; )
I edited in the missing parenthesis right after posting, but you were so quick to reply that you didn’t see that anymore. I had just skipped them in my post and they are in the template, of course - so that wasn’t the issue.
However, your other suggestion did the trick. Thanks!
Might I ask why though? I realize that an if-statement to ensure you’re dealing with an object before using an object function is good practice, but that still leaves me puzzled as to why the images on the home page of my site do not work if I drop that statement while all the others do.
No other changes were involved; content files remain unchanged and the file exists. And as pointed out, this happens exclusively on the home page of the site.
Ah well, let’s not waste any more of your time in any case; no reason not to have the if-statement anyway.
Thanks again! ; )
Yeah, I changed the actual variable/file names to “myImage” for the sake of the example and missed one. Thanks for pointing it out; edited my post. ; )