I am trying to display tagged images with this snippet :
if($tag = param('tag')) {
$taggedimages = $site->index()->images()->filterBy('tags', '=', urldecode($tag), ',');
dump($taggedimages);
}
But a request with a valid tag leaves me with that prompt
Collection Object
(
[pagination:protected] =>
[data] => Array
(
)
)
So I’m not sure what I’m doing wrong?
bivisual:
$taggedimages = $site->index()->images()->filterBy(‘tags’, ‘=’, urldecode($tag), ‘,’);
your filter method is not correct:
$taggedimages = $site->index()->images()->filterBy('tags', '==', urldecode($tag), ',');
Thank you. That’s right.
Actually I tried with the correct operator but then the dump() just left me with a blank screen, and I’ve been misguided. So for my understanding, could please explain why the dump did not work?