SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2004
    Location
    Newport Beach
    Posts
    1,761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Switched from CData to HTMLSpecialChars in Description - Now Not Showing

    Okay,

    I've been using the CDATA tag in my description container for RSS forever and have decided to get rid of the CDATA container and instead have php just convert all the HTML entities with htmlentities (or htmlspecialchars).

    However, I've done that and now I can't see the properly formatted feed in Firefox.

    http://feed.traileraddict.com/dom-hemingway

    The description doesn't even show up at all. What am I doing wrong? I see that Vimeo does same thing, but successfully, so can't figure out what they are doing different.

    http://vimeo.com/robertkrakower/videos/rss

    All feedback appreciated.

    Cheers!
    Ryan
    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,812
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    CDATA and htmlentities (or htmlspecialchars) are used for totally different purposes and one cannot be substituted for the other. It would be like substituting a cheese sandwich for your car and expecting to be able to drive that to work.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2004
    Location
    Newport Beach
    Posts
    1,761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, I reviewed my output closely and realized I had "<br /><br />" hand written into the Description container which was causing it to fail since illegal characters without CDATA. I added

    PHP Code:
    $doublebreak '<br /><br />';
     
    $doublebreak htmlentities($doublebreak); 
    And then put the $doublebreak variable inside the description container to replace <br /><br /> and it fixed everything and is validating and showing properly in the browser once again (just like the Vimeo comparison).

    Cheers!
    Ryan
    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.

  4. #4
    SitePoint Wizard
    Join Date
    Oct 2004
    Location
    Newport Beach
    Posts
    1,761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Example here: http://feed.traileraddict.com/dom-hemingway (you can now see the descriptions with HTML characters decoded, though still displaying).
    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •