Results 1 to 7 of 7

Thread: gfeedfetcher tweak

  1. #1
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default gfeedfetcher tweak

    1) Script Title: gfeedfetcher

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...sdisplayer.htm

    3) Describe problem:

    I'm trying to modify the gfeedfetcher script so that it identifies the final rss entry to be displayed and adjusts the class of that div accordingly.

    EX:
    In the page, I have this set:
    newsfeed.setentrycontainer("div class=home-feed-box-events")

    So all entries display within <div class="home-feed-box-events">ENTRY</div>

    What I would like is for the script to identify the last entry and make that div only look like this: <div class="home-feed-box-events last">ENTRY</div>

    Any help would be super appreciated. I have been running into a wall trying to make this work all day.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ok, try the below modified gfeedfetcher.js file. It modifies the setentrycontainer() method so you can specify a default list of classes to add to all RSS entries, plus another parameter to specify the classes to add on top of that to the very last entry. So something like:

    Code:
    cssfeed.setentrycontainer("div", "home-feed-box-events", "final")
    Note that the first parameter should only be used to specify the container tag, and nothing else.
    DD Admin

  3. #3
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You are a life saver! Thanks!

    (officially a life-long fan of DD forums!)

  4. #4
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Another question:

    The RSS feed we are pulling from contains an image in the description of each entry. These images are surrounded by a classed div tag. When gfeedreader grabs the description field, it leaves the div tags but strips out the div class.

    Ex: in the rss feed we have <div class="rssimg"><img src="..."></div> which gfeedreader outputs as <div ><img src="..."></div>

    Is there anyway to prevent that from happening? I would like to keep that div class in place.

    Thanks again!

  5. #5
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Actually a little digging tells me that it is the Google Feed API that strips out the classes / ids from the original rss. One possible solution I saw was to load the feed entries as xml instead of json. Any help on how I would go about doing this?

  6. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hmm while it's certainly possible to modify the script to load the feed in XML format, the changes to the script required to get this to work would be rather intensive. Is the tag that's being stripped out always simply "<div class="rssimg">", or does it change depending on the news item? If the later the script can simply be modified to hard code the lost tag into its output for each of the news entries.
    DD Admin

  7. #7
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    After I posted that, I realized it would be a major overhaul of the script. And with a bit more research I am seeing that it probably wouldn't end up working anyway (google would still strip out the tags).

    Basically what is happening is that in our rss feed, as I mentioned, we have images linked into the description field. I am able to hardcode a div class into your script that surrounds the entire description field (image and text). What I was trying to do was setup our rss feed to output something like:

    <div class="rss-img"<img ...></div><div class="rss-desc">Lorem ipsum...</div>

    for the description of each rss entry. That way I could style each part individually and in some cases hide the text entirely if necessary. Unfortunately, google strips out the class or id tags from any divs coded into the rss feed. Strangely enough, google does not strip out inline styles, but that doesn't help me.

    I figured out a couple work arounds though, so I should be good to go. They aren't the most ideal, but they work so I'm happy.

    Thanks again for all your help!

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
  •