Escaping preparsed variable content
Is there any way to escape preparsed variables when their content contains the same quotes used to set the preparse parameter?
For example
preparse:dude="He goes by the name "Low""
I know I could change the outer double quotes to singles but I've no control over what may be entered in the future and it's very likely a single quote could be used at some point within the content.
Replies
Low 10 Apr 2013 15:50
That's a tricky one. The parameters are just like any other. No simple, elegant way to escape quotes. But if the variable you're passing is a late parsed one, the issue shouldn't occur.
Jamie Pittock 10 Apr 2013 16:16
So this is related to that query I emailed you about yesterday. I figured I'd stop bugging you and go the official route ;)
The
{instructions:cf_organisations_email}is a Safecracker variable.I don't know whether that's an early or late parsed variable.
My problem is that custom field instructions could possibly have double quotes in them.
I guess I could wrap it in a plugin that converts " to
". Would that make it through?Low 10 Apr 2013 17:47
Yeah, using " instead of " would work. You could use Low Replace for that, but that could make things pretty verbose and obtuse.
Also, you'd have to put the plugin inside the parameter, ie.
preparse:my_var="{exp:quot}{my_variable}{/exp:quot}"...which means you'd have to use parse="inward" as well.
Jamie Pittock 11 Apr 2013 16:10
Thanks mate.