View Full Version : gAjax RSS Ticker - title too long in IE7

09-23-2007, 02:08 PM
1) Script Title: gAjax RSS Ticker

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxrssticker.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.

09-24-2007, 02:00 AM
You can limit the length of the title by editting the variable:


inside feedfetcher.js to something like:

feeds[i].title.substring(0, 25)

where the "25" means display the 1st 25 characters of the title.

09-27-2007, 08:34 AM
Is it also possible to limit the characters displayed when 'description' is enabled please?
I tried adding the above to
in feedfetcher but it didnt work.

09-27-2007, 08:59 AM
Ah my bad. Since you're using gAjax ticker here, the .js file you need to edit is actually gajaxticker.js:

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.

09-27-2007, 09:30 AM

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

09-28-2007, 03:16 PM
That's excellent, I will try that, thanks so much! :)