Manaus Posted May 7, 2014 Share Posted May 7, 2014 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 More sharing options...
bwakad Posted May 7, 2014 Share Posted May 7, 2014 I have to warn I do not have much knowledge.... but did you try: $pages->find("template=xx,utenti={$myuser}") or perhaps $pages->find("template=xx,utenti=".$myuser) Link to comment Share on other sites More sharing options...
Martijn Geerts Posted May 7, 2014 Share Posted May 7, 2014 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 More sharing options...
Manaus Posted May 7, 2014 Author Share Posted May 7, 2014 Ahh! The magic! Usually I do not cosider it as often as I should... Thanks @bwakad && @martijn ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now