js newsfeed issue ...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
jmueller0823
Forum Commoner
Posts: 37
Joined: Tue Apr 20, 2004 9:06 pm

js newsfeed issue ...

Post by jmueller0823 »

We have several newsfeed headlines displayed on our homepage.
Each headline displays via a line of code like this:

Code: Select all

<a href=&quote;http://headlines.site.org/users/mysite/link.asp&quote;>
<script src=&quote;http://headlines.site.org/headlines/headline2.js&quote;></script>
Problem
Sometimes the feeds are slow and affect the load time of our page (sometimes the page will hang for minutes).

The solution I envisioned was to take a daily 'snapshot' of a successful feed (wget?) and then display the headlines as static.

That won't work because wget copies the actual js code.

So, what I'm thinking now is this:

1] Display the js files,
2] extract their text links, and
3] use a different method to place it on the page

Perhaps an intermediate step is to write the links to a text file.

Trying to keep this simple... but...

Ideas? Comments?

The obvious fix would be for the newsfeed host to provide a reliable feed. They tell me they have a timeout built in, but I don't see it...

Thanks.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

If this is affecting your page then what you can do is have a onload function in the body tag:

Code: Select all

<script type=&quote;javascript/text&quote;>
function showHeadLines()
 {
 	document.write('<scr'+'ipt src=&quote;http://headlines.site.org/headlines/headline2.js&quote;></scr'+'ipt>');
 }
<script>
.
.
<body onload=&quote;showHeadLines()&quote;>
.
.
.
</body>
.
.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

You have already made a post like this in this forum. I am locking this post and moving your last comment on to that page.

viewtopic.php?t=31633&highlight=

Please do not create multiple threads for the same problem.
Locked