Jump to content

has() or = ?


Manaus
 Share

Recommended Posts

Hi,
just trying to clear knowledge so far.
I have a template with a "utenti" users field.
I can get the desired pages with

$pages->find("template=xx,utenti=$myuser")

But using the api I have to do

if ($page->utenti->has($myuser)) ...

I have trouble understanding the differen for the same expression has and =, why not using *= (contains) in the selector? Or $page->utenti = $myuser?

Thanks

Link to comment
Share on other sites

if ($page->utenti->has($myuser)) ...

/**
 * the current page with a Pagefield multiple named utenti has $myuser.
 * ($myuser should be User or Page)
 * So this depends on the selected or checked state of the field.
 */

so, does the Pagearray (those selected in the page) contains $myuser

--------------------------------------------------------
 $pages->find("template=xx,utenti=$myuser")

/**
 * Find pages with the template named xx and pages should have $myuser in the utenti field.
 *
 */
  

$myuser used here will echo the ID of that Page/User. But it's actually an Object derived from Page. The print/echo of the ID is done internaly with some magic.

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