Results 1 to 6 of 6

Thread: gAjax RSS Ticker - title too long in IE7

  1. #1
    Join Date
    Sep 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default gAjax RSS Ticker - title too long in IE7

    1) Script Title: gAjax RSS Ticker

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

    3) Describe problem: The ticker works perfectly in Firefox, and if the title of the feed is too long, it doesn't muck up the overall page layout.

    However, when viewing the same page in Internet Explorer 7, if the title overflows, it pushes all the page elements down, which completely throws the page out.

    Is there any way to restrict the title length, or ensure the format doesn't affect the other page elements?

    I have the ticker in a table 1x1 embedded within another table (I designed the page using Fireworks and allowed a slice for the ticker)

    Any ideas?

    Thanks in advance.

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

    Default

    You can limit the length of the title by editting the variable:

    Code:
    feeds[i].title
    inside feedfetcher.js to something like:

    Code:
    feeds[i].title.substring(0, 25)
    where the "25" means display the 1st 25 characters of the title.

  3. #3
    Join Date
    Sep 2007
    Location
    Buckinghamshire, England
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Is it also possible to limit the characters displayed when 'description' is enabled please?
    I tried adding the above to
    feeds[i].content
    feeds[i].contentSnippet
    in feedfetcher but it didnt work.

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

    Default

    Ah my bad. Since you're using gAjax ticker here, the .js file you need to edit is actually gajaxticker.js:

    Code:
    function formatrssmessage(feedslice, showoptions, itemcontainer, linktarget){
    	var rssoutput=(itemcontainer=="<li>")? "<ul>\n" : "" //if "itemcontainer" is set to "<li>", define a "<ul>" tag to wrap around the result
    	for (var i=0; i<feedslice.length; i++){ //Loop through the entered slice of a RSS feed (1 or more entries)
    		var itemtitle="<a href=\"" + feedslice[i].link + "\" target=\"" + linktarget + "\" class=\"titlefield\">" + feedslice[i].title.substring(0, 25) + "</a>"
    		var itemlabel=/label/i.test(showoptions)? '<span class="labelfield">['+feedslice[i].ddlabel+']</span>' : " "
    		var itemdate=gfeedfetcher._formatdate(feedslice[i].publishedDate, showoptions)
    		var itemdescription=/description/i.test(showoptions)? "<br />"+feedslice[i].content.substring(0, 100) : /snippet/i.test(showoptions)? "<br />"+feedslice[i].contentSnippet.substring(0, 100)  : ""
    		rssoutput+=itemcontainer + itemtitle + " " + itemlabel + " " + itemdate + "\n" + itemdescription + itemcontainer.replace("<", "</") + "\n\n"
    	}
    	rssoutput+=(itemcontainer=="<li>")? "</ul>\n" : ""
    	return rssoutput
    }
    The changes are in red and to cover trimming both the title and description. For your convenience you can just replace the original formatrssmessage() function with the above.

  5. #5
    Join Date
    Sep 2007
    Location
    Buckinghamshire, England
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    FANTASTIC !

    Thank you very much. I wouldnt have had time to keep visitors updated with news, now i can. Excellent.

  6. #6
    Join Date
    Sep 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks!

    That's excellent, I will try that, thanks so much!

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
  •