ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

stripping / slash / escape quotes in titles

July 14, 2008 11:42am

Subscribe [1]
  • #1 / Jul 14, 2008 11:42am

    matt romaine

    50 posts

    Similar to the issue in this thread,
    I have a title that has quotes in it - so when I need to conditional around it, I get an EE error.

    The title is

    lein: “Pictures at an Election or How to get Votes in Japan”. Ein Dokumentarfilm von Axel Klein zu Wahlkampftechniken in Japan.

    The code which triggers the problem:

    <input type="hidden" name="event_name" value='{if event_title_{lc}}{event_title_{lc}}{if:else}{event_title_de}{/if}' />

    If I put single quotes around the conditional variable:

    <input type="hidden" name="event_name" value='{if 'event_title_{lc}'}{event_title_{lc}}{if:else}{event_title_de}{/if}' />

    then we’re okay BUT this assumes the quotes in the title are double quotes.  Is there a universal solution allowing for both single and double quotes in an entry field that may need to be in a conditional?

  • #2 / Jul 14, 2008 11:56am

    Robin Sowell

    13255 posts

    I’d about swear single quotes are encoded in the title field.  That said- I’m not entirely sure what’s up in that code.  What’s lc and where is it coming from?

  • #3 / Jul 14, 2008 1:31pm

    matt romaine

    50 posts

    cheers for the prompt reply.

    “lc” are global variables I use for localization / multilingual support.  For example, Japanese users would get the value inside event_title_jp, German users would get the value inside event_title_de.  Let’s me use one template and pull out the correct field based on language code.  It’s documented in the wiki on multilingual sites.

    So, single quotes I don’t have to worry about then ... what about the double quote issue then? 😊

  • #4 / Aug 12, 2008 3:16pm

    Lisa Wess

    20502 posts

    Hi, Matt—

    Did you still need help with this?  If you do, I may need to move this up to How To to explore a solution.  You may need a plugin to do some cleanup to allow for all quote types.

  • #5 / Aug 13, 2008 3:28am

    matt romaine

    50 posts

    In short, I still need help with this.

    Quotes, etc. are handled nicely if the content formatting method is set to XHTML.  “None” and “<br>” don’t encode quotes, etc.

    It would be nice if there was a formatting method to only encode entities.  Basically, if there was a formatting option like “XHTML” but *not* wrap everything in tags, then I believe the above issue would be resolved.

  • #6 / Aug 13, 2008 11:11am

    Robin Sowell

    13255 posts

    Ouch- you got forgotten there for far too long.  Feel free to bump if we miss you like that again.

    Hm- I am going to shift to ‘How to’- but sounds like you want default formatting to be xhtml lite- which is basicaly xhtml w/out the p tags.  Wonder if xhtml typography allows you to select ‘light’ as an option for formatting type.  Might try that.

  • #7 / Aug 16, 2008 5:19am

    matt romaine

    50 posts

    thanks for the plugin link - that would be helpful in some cases.

    however, the original issue arose when referencing the field-data in an EE conditional.  since you can’t embed EE tags inside EE conditionals, the only way i can see getting around this problem is if an XHTML Typography Light were an option in the Formatting Option drop-down associated with each field on a Publish tab.  Is it easy to add new formatting options in this area?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases