Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

News Feed 2

Status
Not open for further replies.

robdunfey

Technical User
Apr 26, 2002
110
GB
Hi-

I would like to make a news feed. So people can copy and paste code into their web page. Everytime their page loads it then displays news I specify. How do you go about doing this?

Any help on this subject would be much appreciated.

Rob
 
You create a javascript file that people can include on their page directly thus:

Code:
<script type=&quot;text/javascript&quot; src=&quot;[URL unfurl="true"]http://www.someplace.com/newsfeed/short.php&quot;[/URL] />

Then you edit/maintain the file short.php. Maybe short.php contains some server side code that queries your local mySQL database and massages some news into javascript variables... and then document.writes them.

When the user includes your script on their page, you will be document.writing directly onto their page... so you can include a link that clicks-back to your main website (maybe).

You can perform a similar task to generate an XML feed as well if you wanted!

Does this make sense to you?

Jeff
 
The standard way of doing this is using RSS (Really Simple Syndication) which is an xml feed.

This would be a little more complex (but still Really Simple apparently!) than the js solution suggested but is much more flexible and it would even be possible for people to get you news on their desktop using a news reader.

MrBelfry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top