I rediscovered a nifty piece of javascript code today that placed a typewriter-style newsfeed on the page. I was wondering where to put it so that I would see it each day, and since I post every day this weblog seemed like the logical place. The script is more for my own benefit, though readers may find the headlines interesting enough to check them out. I've placed the code into my footer, which is a php included file, so it will appear on all the pages.
Installing Type Writer news feed
This is how you add the typewriter-based news feed renderer to your page.
1) Download newsfeed-typewrite.zip. Unzip the downloaded archive in the same directory where your web page is located on your web server. A directory called newsfeed-typewrite is created, containing the needed files. You can also create the files yourself in MT using a new index template; either way will work.
2) Place the following lines in the <head> section of your page:
<link rel="stylesheet" href="newsfeed-typewrite/newsfeed-typewrite.css" type="text/css" />
<script language="JavaScript" src="newsfeed-typewrite/newsfeed-typewrite.js" type="text/javascript"></script>
<script language="JavaScript" src="http://www.erfilter.com/international.js" type="text/javascript"></script>
The first line includes the style sheet which defines the fonts and colours to use in the news feed. You can edit this in any popular web page editor to customise the feed to the look and feel of your website. The second line includes the code needed to generate and control the rendering of the news feed. The last line includes the file which contains the headlines (see below).
3) Just place this line in your webpage or template where you would like the news feed to be displayed.
<script language="JavaScript" type="text/javascript">createNewsfeedTypewrite()</script>
Choosing the headlines
If you would like to change the news subject area of the news feed, these are all of the subject areas currently available. Just change the international.js above for one of these:
| Arts = arts.js | Sci-Tech = scitech.js |
| Business = business.js | Politics = politics.js |
| International = international.js | Space = space.js |
| International Sport = internationalsport.js | Sport = sport.js |
| Health= health.js | UK = uk.js |
| Linux = linux.js | USA = usa.js |
| Perl = perl.js | UK Sports = uksports.js |
| Music = music.js | USA Sports = usasports.js |
| Technology = technology.js | Visual Basic = visualbasic.js |
| Java = java.js |

Leave a comment