Tyssen Posted March 26, 2020 Share Posted March 26, 2020 I want to be able to use the page that a user is assigned to do other things in my templates. If I do this: $ap = $user->editable_pages; echo $ap; I get a number output. But if I do this: $lp = $pages->get($ap); echo $lp->title; I get an error: Unknown Selector operator: '[empty]' -- was your selector value properly escaped? If I hard code the actual number from echo $ap in the get selector then I get the output I'd expect. What do I need to do to $ap recognised as a PW page object? Link to comment Share on other sites More sharing options...
horst Posted March 27, 2020 Share Posted March 27, 2020 Maybe your $ap is a pageArray and not a single page? Maybe you test this better with var_dump($ap), as you seems to be in scope of template files, it will out strings / numbers, but it is a pageArray. Check this, or check with echo count($ap); or echo $ap->first(); to see if it is a number or an array. 1 Link to comment Share on other sites More sharing options...
Tyssen Posted March 27, 2020 Author Share Posted March 27, 2020 Yep, that was it, thanks. ? 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