News feed

U

[UKLans]Khan

Guest
Hello all,

My site has news that is updated daily, I have had a number of requests to have a news feed facility where by the people who want my news on thier site copy and paste a bit of java and can have my news content on thier site.

I have created the asp news feedpage:

http://www.uklans.com/feed/feed.asp?s=2&i=5

s is the text size so s=7 would make very big text

i is the news items posted, so 5 would show 5 news items (it is capped at 10)

I am having trouble with the code that inserts it into the clients code:

<script language="JavaScript" src="http://www.uklans.com/feed/feed.asp?s=2&i=5">
</script>
<noscript>Sorry, you need a JavaScript capable browser to get news headlines on this page</noscript>

But it comes up with a javascript error:

http://www.uklans.com/test.htm

What am i doing wrong?

Thanks in advanced,

Khan
 
J

Jonty

Guest
Hi Khan

Sorry, just a flying visit, so I doubt how helpful I can be. Anyway, just a couple of things I noticed. Firstly, the page your linking to is written in ASP, yet the language your asking the browser to parse is set to JavaScript. There's a fundamental difference, as I'm sure you know, between ASP (a server side language) and JavaScript (a client side language). Surely the information would have to be imported via a different, server-side method?

Secondly, I would consider using an RSS feed for your news. They are becoming an ever more popular, standardised way of delivering news content and headlines. All the partner sites would need is a standard XML/RSS parser and they're away. RSS feeds can also be integrated into programs like Trillian.

Sorry I can't be of more help
 
U

[UKLans]Khan

Guest
K thanks for the feedback Jonty, I did think that the page would only feed through the output as html, I will do some looking into a RSS feed.

Thanks m8ty,

Khan
 
U

[UKLans]Khan

Guest
Mind you, back to the javascript/asp link issue, vibrant media use the following code to allow users to use thier feed:

<script language=javascript>var d;d=new Date();d=d.getMilliseconds();</script>
<script language=javascript SRC="http://www.vibrantmedia.com/system/newcse.asp?ContentPurchasedID=17978&ArticlesPerPage=5&js=1&ho=1&ticker=0&FrameTarget=_self&target=BLANK&d="+d></script>

Hmm, will look into this.

Khan
 
O

old.LeitMotif

Guest
Hi,

Be warned.. my scripting is v.rusty.

If you get your asp page to output pure javascript then you can write to the page using your current method

..For example if http://www.uklans.com/feed/feed.asp?s=2&i=5 was to ouput something like: -

Code:
document.write('<table>');
document.write('<tr>');
document.write('<td class="khanNewsTitle">[myNewsTitleText]</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td class="khanNewsCategory">[myNewsCategoryText]</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td class="khanNewsBody">[myNewsBodyText]</td>');
document.write('</tr>');
document.write('</table>');


Dont forget that you would need to URLEncode any text from your ASP application than you were writing into a javascript block.. e.g

"My Quote" becomes &amp;quot;MyQuote&amp;quot;

HTH :)
 
U

[UKLans]Khan

Guest
It works now thanks, this will do for now until I look into the RSS feed.

The finished feed can be found here:

http://www.uklans.com/test.htm

I have got a couple of things to do and then I will let a couple of my users test it for me.

Thanks again old.LeitMotif and Jonty.

Khan
 

Users who are viewing this thread

Top Bottom