Jump to content

[SOLVED] Selector - single quote/apostrophe breaking returning no results


alexm
 Share

Recommended Posts

I'm having a bit of a problem with a selector:

pages()->get("template=blog-post,blog_categories.title=$page->title,sort=-publish_from,images>0");

The selector works for all pages however this page's title is Women's Team and the category page title is also Women's Team.

If I change the selector to:

pages()->get("template=blog-post,blog_categories.title=Women's Team,sort=-publish_from,images>0");

It works as expected.

Is this expected with apostrophes? I thought apostrophes were acceptable in selector string queries?

Thanks in advance.

Link to comment
Share on other sites

Have you tried running the title through $sanitizer->selectorValue()?

That's what you should be doing anyway, passing "raw" values to selectors is never a good idea — even if said value comes from a field on the page ?

Link to comment
Share on other sites

@teppo and that's done it!! Thank you. Weirdly when I tested the output of $page->getUnformatted('title') earlier with an echo I got no output, but now I am.

Thank you again for your help, time, expertise and all. Being the weekend too! ?

 

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