Jump to content

Recommended Posts

Posted

You'll need to use the $sanitizer, and in your case I think it would be:

$url = $sanitizer->pageName($title, true);

Obviously $title is whatever your title is.

I'm not sure how it works with some characters, so let me know if that works for you.

Full documentation on $sanitizer is here: http://processwire.com/api/variables/sanitizer/

Posted

There's also setting that can be made in the InputfieldPageName module for converting chars, like ä to ae. 

Posted

Hmm, I changed the setting like Soma said but it doesn't have any influence on "$sanitizer". Is there may a way to change it for $sanitizer?

Posted

That setting for the InputfieldPageName module isn't used by $sanitizer. That is just used by the runtime javascript that performs conversions when you are entering characters in the page title (or directly in the page name) field.

$sanitizer instead uses PHP's iconv() to perform conversions, and the translations it performs will depend on PHP's locale settings, or you can adjust them with PHP's setlocale() function. Such a thing (iconv) wasn't possible with just javascript (used by InputfieldPageName), which is why it's separate. Though with PW 2.2 and the multi language support, we will likely provide an option to have the $sanitizer->pageName() and InputfieldPageName pull from the same language-specific config data.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...