How to Embed Chapter News on Your Website
Items submitted to AFCEA/SIGNAL Magazine Chapter News using the online form can be repurposed for use back on the chapter's website reducing the need to maintain multiple copies of the information.
For RSS feeds by chapter for Chapter News the following URL syntax will work with the correct chapter name added to the end.
2 Examples are listed below:
These links are available for any chapter by going to chapter news, selecting News by Chapter from the list, picking a chapter, and then clicking the RSS button at the bottom of the results.
The RSS button is also available when you do a keyword search so you can do a feed by a particular topic across chapters -- for example if I wanted a feed for all the entries where "Teaching Tools" appeared I would search and get the feed link - http://www.afcea.org/signal/chapternews/rss.cfm?searchword=Teaching%20Tools
OK so part one, getting the RSS Feed link, is easy. The more difficult part is to embed it in a website. Below is the code we use here at HQ in several places on our website to take the RSS feed and spit out a block of content for part of a web page. This will work for any chapter hosting on our free Chapter Web Server as well.
Info below targeted to chapter webmasters:
Assuming below that web host is IIS/ASP capable. Chapters hosting on our free server will have no issues. Similar model works with Apache/PHP but not detailed here:
3 Snippets of code to make this all work:
1 - Create an asp page that processes an XML link. Save the asp code below to any webserver folder and name the file rss.asp
dim source, style
styleFile = Server.MapPath("rss.xsl")
set source = Server.CreateObject("Msxml2.DomDocument")
source.async = false
source.setProperty "ServerHTTPRequest", true
set style = Server.CreateObject("Msxml2.DomDocument")
style.async = false
xmlstring = source.transformNode(style)
set source = nothing
set style = nothing
xmlstring = replace(xmlstring, "'", "'")
2 - Create an XSL file that processes the XML into HTML syntax. Save this file as rss.xsl in the same folder as the file above. Pick a number of entries you'd like to display by changing the number 8 to any number you like in the 5th line.
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="iso-8859-1" omit-xml-declaration="yes" indent="yes"/>
<xsl:for-each select="//item[position() < 8]"><li><a>
<xsl:attribute name="href"><xsl:value-of select="*[local-name()='link']"/>
<xsl:value-of select="*[local-name()='title']" disable-output-escaping="yes"/>
3 - Last step is to include the rss.asp somewhere in an existing web page. An asp sample include is below. Again presumes the parent file calling the rss.asp include is in the same folder.
<!-- #include virtual="rss.asp"-->
That's it! Now chapter news info submitted to HQ can appear real time on your own website.