All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Escaping preparsed variable content

Jamie Pittock 10 Apr 2013 15:29 question, complete

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

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

  2. 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 ;)

     
    {exp:safecracker}
    {exp:low_variables:single
    var="lv_form_field"
    preparse:pp_instructions="{instructions:cf_organisations_email}"
    }
    {/exp:safecracker}


    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?

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

  4. Jamie Pittock 11 Apr 2013 16:10

    Thanks mate.