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.

How to retrieve non-entitied html

December 19, 2011 1:27pm

Subscribe [3]
  • #1 / Dec 19, 2011 1:27pm

    vodkafish

    122 posts

    Not sure how to phrase it, but my example should make plenty of sense.

    I make the title of a story:
    Him & Her

    When I fetch the title I get:

    Him & Her

    How do I get back the raw title: Him & Her

    Is there a native EE way to do that?  If not, if anyone knows a plugin off-hand, that’d be great.

  • #2 / Dec 20, 2011 11:37am

    Kevin Smith

    4784 posts

    Hi VodkaFish,

    Could you show us the template code you’re using to display your Channel Entry title?

  • #3 / Dec 20, 2011 12:11pm

    vodkafish

    122 posts

    Sure:

    {exp:channel:entries limit="5" rdf="off" disable="member_data" channel="mychannel" disable="categories|custom_fields|member_data|pagination" backspace="1"}
    {value: "{comment_url_title_auto_path}", text: "{title}"},{/exp:channel:entries}

    Template type: javascript

  • #4 / Dec 21, 2011 12:51am

    Kevin Smith

    4784 posts

    I’m sorry, I’m not familiar with this part of your template code:

    {value: "{comment_url_title_auto_path}", text: "{title}"}

    Is that coming from an add-on you’re using?

    Do you get different results output to your template if you just use

    {title}

    within your Channel Entries tags instead?

  • #5 / Dec 21, 2011 1:03am

    vodkafish

    122 posts

    I don’t get different results. 

    That’s not from an add-on, it’s just part of a javascript function.

    The output is fine (including the {} when they should be there) outside of me needing to not have the html entities in there, just the raw characters.

    & is still &

    etc

  • #6 / Dec 21, 2011 1:20am

    Kevin Smith

    4784 posts

    Ah, I see now. This is a JavaScript template. My apologies for missing that the first time around.

    I do believe this is expected behavior, for EE to convert entities like this. I would recommend using an add-on like PHPStringFun to allow you access to PHP string functions like html_entity_decode() that will keep the ampersand from being displayed as an entity.

  • #7 / Dec 21, 2011 1:42am

    vodkafish

    122 posts

    Ah, ok.  Thanks for the suggestion.  I’ll use that or straight PHP.

  • #8 / Dec 22, 2011 1:48am

    John Henry Donovan

    12339 posts

    Glad Kevin was able to help. Feel free to start a new thread if you have any more questions

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

ExpressionEngine News!

#eecms, #events, #releases