Jump to content

How to check is part of page array ?


iNoize
 Share

Recommended Posts

Hello, 

i have several groups as pages for objects. 

called $gruppe 

echo $gruppe // delivers eg 1045| 1043 |1041

how can i check for example 

if($gruppen ~= "1045"){echo "in the gruop ";}

which is the right way to check this ? 

Tnx 

Link to comment
Share on other sites

// works with keys / selectors
// will return null if not present
if($pageArray->get(1045)) //do something;
if($pageArray->get("id=1045")) //do something;

// Works for the above types and also
// if you've already an page object to compare
if($pageArray->has($page)) //do something;

You'll find both of them here: http://cheatsheet.processwire.com/

  • Like 1
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...