interrobang Posted April 29, 2021 Share Posted April 29, 2021 For an import script I need to match existing pages by page title, but some of the titles include a pipe. I cannot find a selector to get these pages. I have no idea what else to try. $title = "test | test"; // Non of these selectors get my existing page: pages()->get("template=edition, parent=3997, title=" . sanitizer()->selectorValue($title)); pages()->get("template=edition, parent=3997, title=$title"); pages()->get([ 'template' => 'edition', 'parent' => 3997, 'title=' => sanitizer()->text($title), ]); Link to comment Share on other sites More sharing options...
horst Posted April 29, 2021 Share Posted April 29, 2021 What is with an options array that contains a blacklist without the pipe sign? $options = [ 'blacklist' => [ '"', "\\0", "\\", "`", '=', '*', '%', '~', '^', '$', '#', '<', '>', '[', ']', '{', '}', "\r", "\n", "\t"] ]; sanitizer()->selectorValue($title, $options); Link to comment Share on other sites More sharing options...
BitPoet Posted April 29, 2021 Share Posted April 29, 2021 5 minutes ago, horst said: What is with an options array that contains a blacklist without the pipe sign? Or going the other way round, adding the pipe to the whitelist (and forcing quotes for it): $ptions = [ 'whitelist' => ['|'], // selectorValue() normally strips out pipe symbols, so allow them 'quotelist' => ['|'] // Have selectorValue quote values that contain a pipe symbol ]; 3 Link to comment Share on other sites More sharing options...
interrobang Posted April 29, 2021 Author Share Posted April 29, 2021 Thank you both, unfortunatelly I can't test your suggestions right now, because the site is still using PW 3.0.150, which doesn't has these options. Upgrading PW to the latest dev broke my site, so I had to return to the old version for now. But I could solve my issue for now by quoting the value in the selector. After updating PW I will try your suggestions. pages()->get("template=$templateName, parent=$parent, title=\"$value\""); 2 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