PDA

View Full Version : Advanced RSS Ticker (Ajax invocation)



bobster
06-10-2012, 09:47 AM
1) Script Title:

RSS Ticker

2) Script URL (on DD):

http://www.dynamicdrive.com/dynamicindex17/rsstickerajax/index.htm

3) Describe problem:

Trying to put on another site to read the rss feed but doesn't seem to be able to work.

jscheuer1
06-10-2012, 04:19 PM
Are you syndicating? That is do you have the Advanced RSS Ticker files on one domain and the page that uses them on another? If so you need the absolute path to bridge.php in rssticker.js:


//Absolute URL syntax. Uncomment below line if you wish to use an absolute reference:
//var lastrssbridgeurl="http://"+window.location.hostname+"/lastrss/bridge.php"

Only that's not how it should be done exactly. That window.location.hostname part will still only work if the page using the script is on the same domain as the script. Say the Advanced RSS Ticker files are on one.com and the page using them is on two.com, it should be like:


//Absolute URL syntax. Uncomment below line if you wish to use an absolute reference:
var lastrssbridgeurl="http://www.one.com/lastrss/bridge.php"

If that's the correct path. If there are other folders involved, include them in the path.

If that's not the situation (syndication), and/or you're still having problems and want more help:

Please include a link to the page on your site that contains the problematic code so we can check it out.

bobster
06-11-2012, 04:27 AM
If I uncomment the absolute path, is still doesn't work for syndication and also stops working on my site.

jscheuer1
06-11-2012, 05:44 AM
It must still reflect an accurate path to the bridge.php file. If it stops working on your site, it obviously isn't doing that.

But - Whoops, this is AJAX. I don't think there is any way to syndicate it because the page showing the ticker(s) must be able to make a same domain request to the bridge.php file. There's no way that can happen unless the page and bridge.php are both on the same domain.

Best you can do on that score with this script is to use an iframe on the remote domain to show working page on the primary domain.

An alternative that can be syndicated is:

http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/index.htm

bobster
06-11-2012, 11:00 AM
This version syndicates great. But the formatting for the bottom shown here http://fxanimation.com/rss/demo.htm is messy. The script that didn't syndicate has a nice format shown here http://fxanimation.com/rssticker/demo.htm Is there a way to get that formatting back?

Thank you for all your help?

jscheuer1
06-11-2012, 03:20 PM
The one you like is in quirks mode (no DOCTYPE) and the one you don't is in standards mode. This may account for some of the differences.

The one you like is wider - that's set in the on page css (from the one you don't like):


#pscroller2{
width: 400px;
height: 200px;
border: 1px solid black;
padding: 5px;
background-color: #F0F0F0;
}

Increase it.

Also, the one you like employs table for formatting. I assume those are in the feed itself and are somehow being stripped out of the one you don't like. I'm not sure how that's happening, or if they're even being stripped, some other mechanism might account for the difference, but I'm 100% sure there are tables in the one you like and not in the one you don't.

Also, the one you like (ticker) adapts its height to the content size of each item. The scroller needs to have its height set, and that height has to accommodate the tallest possible expected content for any given item, thus showing a gap at the bottom for shorter items.

In order to do that, the ticker has no height set for it, only width. As a result, it would make the rest of the page below it (if there were any content there) jump around. It could be positioned absolute to avoid that, but then room would have to be allocated so that it wouldn't cover content below it when it gets tall. This would result in the same sort of gap described for the scroller.

Even with no content below, it looks a little odd as it's changing its height with each different sized content.

So, unless there's some way to get the scroller to behave differently in this regard than that and differently than it currently does, there will be trade offs there.

And the one you don't like has trailing garbage, and lacks the FX logo. The former is something in the script and/or how lastRSS is being used. The latter is css again. In the one you like that FX logo is set as background for the container of each feed.

In any case, I don't really like lastRSS for this. I have a version of the scroller with other improvements that uses simplepie. It has an allowtags option, we can try putting all the table elements (table, tbody, tr, th, td) into that variable so it can show the tables if in fact they're in the feed.

Give me the feed url and I'll see what I can work out.

bobster
06-11-2012, 04:00 PM
This is the feed url http://fxanimation.com/clip/rss/recent

Thank you,
Bob

jscheuer1
06-11-2012, 06:50 PM
Try this demo out:

4479

For syndication you will have to configure the absolute path to scrollerbridge.php in the rsspausescroller.js file. I think that's the only place that needs it.

Notice that the linktarget is now configured in the on page call to the scroller. I already set it to _blank. This affects both the title and description links. The tagsallowed and feeds are already setup as well. For your information though, they're in scrollerbridge.php in the simplepie folder. That file is much as it was in the lastRSS version of the scroller script.

You might want some other tweaking as to style, etc. Let me know if you cannot handle it on your own.

I cropped the logo to the size of the visible image so it would be easier to position.



BTW - That feed, according to several of my browsers (Opera 11, Firefox 12, IE 9), is an invalid feed, and so won't show directly in any of them (showing Opera's error message, it's the most informative):


XML parsing failed

XML parsing failed: syntax error (Line: 4, Character: 0)

Reparse document as HTML
Error:
XML declaration not at beginning of document
Specification:
http://www.w3.org/TR/REC-xml/
1:
2:
3:
4: <?xml version='1.0' encoding='UTF-8'?>
5:
6: <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
7: <channel>

Doesn't seem to bother any of the feed parsers used by these scripts though. Still you might want to look into correcting that.

bobster
06-13-2012, 05:42 AM
Wow. That's works great! Thank you so much.

bobster
06-13-2012, 08:58 AM
Can you recommend a good script for emailing rss feeds?

jscheuer1
06-13-2012, 04:58 PM
Sorry, I didn't even know such an animal existed. Are there any?

If you clean up the feed as suggested in my previous post, you could email a link to it. That way your recipients could click on it to see it.

Other than that, if you want to email the actual feed contents, you would need a server side script to assemble them and place them in the body of the outgoing email. That would be something like scrollerbridge.php (outputs javascript) and bridge.php (outputs XML), but different. It would output HTML to be incorporated into the body of the email, an email that's set to display HTML. Or it could output whatever format the email needs to display HTML or text. Remember, recipients may have HTML turned off in their email reading program. That's a fine point. You could have link to the feed (again if you clean it up) that says:

"If you're having trouble reading this email click here"

And have that link to the feed or to a page displaying the feed and the rest of the email message if there's other stuff in the message.

Writing something like that would more or less be from scratch though - beyond what is normally done in a free forum like this. And it's a bit outside my comfort zone as well. I don't know a lot about server side email.

Another option, again you would have to clean up the feed, is instead of offering to sign people up for an email of the feed, offer them the option to subscribe to it. This could be in addition to an option to sign up for a newsletter email if any.

Note: When I say "clean up the feed", there may be other errors than just the blank lines before the opening XML declaration. If so, those would need to be fixed too.

bobster
06-23-2012, 11:40 PM
Hi again. How can I control the size of the images coming in through the feed? They have gotten bigger with new posts.

http://www.fxanimation.com/rss/rssfeed.html

jscheuer1
06-24-2012, 12:43 AM
Sure. You can put something in the stylesheet. If you're not concerned about IE 6, and unless you know of some reason why you should be, I would recommend not worrying about it, you can use max-width and max-height settings. For example:


#pscroller1 .rssdescription img {
max-width: 100px;
max-height: 100px;
}

You would of course want to adjust those values to your liking. What happens is whichever native dimension of the image is the most over whatever is set as max becomes the set max value and the other dimension is scaled to it. If both native dimensions are under the maxes, the image will render in its native size.

If you do want to support limiting the image size in IE 6, you can have an IE 6 specific stylesheet where you set just the width or just the height (not max for either, just width or height). The other dimension will scale to it. But smaller images will be enlarged. But only in IE 6 and less. Then do like (goes in the head of the page):


<!--[if lt IE 7]>
<style type="text/css">
#pscroller1 .rssdescription img {
width: 100px;
}
</style>
<![endif]-->

If you do this for IE 6, you should still do the max-width, max-height bit in the main stylesheet, that will be what is used by all other browsers.