Jump to content

getTag and getRandom (solved)

Recommended Posts


I have this working line to find a specific image.

$banniere = $pages->get(1)->images->findTag('banniere')->getTag($user->language->name);

But now, I want to add getRandom(). I tried different versions


but always received this error : Method Pageimage::getRandom does not exist or is not callable in this context.
Is it compatible? How I can do that?


EDIT : solved by myself. Error I commonly do, mixing up get() and find()...  Sorry for the disturbance.

$banniere = $pages->get(1)->images->findTag('banniere')->findTag($user->language->name)->getRandom();



Edited by mel47
solved myself...
  • Like 2

Share this post

Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...