If you use these snippets, please please tell us about it. Your feedback is very important! - web@cochrane.org
The Cochrane Collaboration offers news columns, up-to-date lists of the latest news items in a specific news category or 'channel'. These columns are available in two popular formats: JavaScript (for display in web pages) and RSS (for display by an RSS news reader).
JavaScript snippet:
You can add a JavaScript news column
to any web page:
1. Add the line of code below to the web page's body, where you want the news to appear, as a single line of code with no line breaks:
<script type="text/javascript" id="version1.1" src="http://news.cochrane.org/view/item/javascript.jsp?channel=X &items=Y"></script>
2. Replace the "X" with the ID number (see table of channels, below) of the news channel you want to display. Note: 'Events' and 'workshops' channels should be displayed with the calendar snippet, not with this news column snippet.
3. Replace the "Y" with the maximum number of news items to display.
Example: The following snippet displays a maximum 5 news items in the news channel with ID number 4:
<script type="text/javascript" id="version1.1" src="http://news.cochrane.org/view/item/javascript.jsp?channel=4 &items=5"></script>
4. (optional) Adjust other display features:
To turn on (display) a feature just add &name-of-feature=on
to the end of the URL
in the snippet just before the quotation mark. Experiment and
have fun!
Common Features:
channeldescription: a few descriptive words about the channel, below the channel title.
rsslink: An orange XML flag that links to the RSS feed for newsreader software.
itemdescription: a 'short' description or 'teaser' just below the article title.
Less-useful features:
itemlongdescription: the full content section of the article - usually you wouldn't want this 'on', as it would appear below each title in the collumn, making a very long web page.
itemexternallink: the "external link for more information" line from the article.
itemcontact: the "contact" section of the article.
Example: The following snippet displays a maximum 5 news items in the news channel with ID number 4, with the short description of the news channel:
<script type="text/javascript" id="version1.1" src="http://news.cochrane.org/view/item/javascript.jsp?channel=4 &items=5&channeldescription=on"></script>
Example: The following snippet displays a maximum 3 items from channel 2, with a link to the corresponding RSS feed (currently an XML flag), and a short description for each news item:
<script type="text/javascript" src="http://news.cochrane.org/view/item/javascript.jsp?channel=2 &items=3&rsslink=on&itemdescription=on"></script>
Example: This spnippet displays all the features (the code would need to be in a single line):
<script type="text/javascript" src="http://news.cochrane.org/view/item/javascript.jsp?channel=2 &items=3 &rsslink=on &channeldescription=on &channeladminemail=on &itemdescription=on &itemlongdescription=on &itemexternallink=on &itemcontact=on"></script>
By default, each news item's title is a link to more information (the item's "long description") presented on a page on the www.cochrane.org. web site. Some news items, though, have a further link to yet another "external" web page. If you would like the news items titles to be linked directly to the item's external page, add:
&itemlinks=direct
5. (optional) Adjust the styles:
You can include the following style snippet in the head of the web page (anywhere between <head> and </head>) to use cochrane.org's news pages styles (colours, fonts, borders, etc):
<link
rel="stylesheet"
type="text/css"
href="http://www.cochrane.org/assets/style_sheets/news/channel.css"
/>
Or you can create your own styles to tailor the resulting calendar to fit in with the rest of your website. Get the stylesheet from the address in the code above, modify as you wish, and place it on your site, and adjust the code above to point to it.
6. (optional) Tell your non-javascript-enabled visitors what news is available. The snippets won't be visible to the small
percentage of visitors who have disabled their web browser's
JavaScript feature. To accommodate them, include the following code just after the </script> part of your snippet:
<noscript>
<p>
<strong>JavaScript Disabled!</strong> If you
are reading this, JavaScript is not enabled in
your web browser. Please turn on your browser's
JavaScript feature to reveal the complete
contents of this web page. The news you are trying
to view may also be available at
<a href="http://www.cochrane.org">www.cochrane.org</a></p>
</noscript>
RSS: "Real Simple Syndication" is an XML format
for actively delivering information to people, rather than requiring
people to search for information that is passively sitting some where waiting to be found.
Anyone with an RSS "news aggregator" or "news reader" installed
on his or her computer can automatically receive your latest news
via RSS without having to remember to visit your web site. More and more news
providers are making their news available in the RSS format and
indicating its availibility with an icon like this:
.
We provide the following RSS news feeds. To add a feed to your news aggregator, copy-and-paste to your news aggregator the web address to which the feed’s XML icon, below, is linked.