Jump to content

Selectors for getting field values


owzim
 Share

Recommended Posts

Well, there is the obvious way:

if($page->title == "some unwanted title") {
    echo $page->headline;
} else {
    echo $page->title;
}

What I'd prefer is:

echo $page->get('title!="some unwanted title"|headline');

but that does not work, is there something wrong with it or is it just not supported?

Link to comment
Share on other sites

Have you tried using $page->find? I was having some issues using $page->get and switched to $page->find and was able to achieve the results I wanted. I do not completely understand the difference between "get" and "find" though.

For an example, I cannot get this to remove the specific page id

foreach($pages->get("/")->children()->remove("id!=100") as $location)

*Edit, Fix the above and now works fine.

Edited by RJay
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

×
×
  • Create New...