I've been trying to find an answer to this question, and it seems like there should be a simple 'output modifier' solution.
I want to use a page's pagetitle as a body class, however, I can't seem to find an easy way to strip out all non-alphanumeric characters besides underscores or hyphens.
Ideally, I want to replace all spaces with dashes, and remove anything else (that isn't a letter or number).
How do I do this? There doesn't seem to be a string output modifier that I can use to accomplish this seemingly simple task.
How about using the alias instead of the pagetitle? It could still contain numbers, but numbers are acceptable in class names as long as the first character is a letter.
create a snippet
sanitize
<?php
return preg_replace('/[^a-z0-9]/', '', strtolower($input));
call on title page
FerX - Developer at Eracom s.r.l.