GrazrScript Tutorial

Displaying multiple feeds

Outline Template

The template in news.xml is called an inline template, because the feed URL is placed directly in the formtemplate tag. You can also place the feed URL in its own outline tag:

<grazr:formtemplate name="newsform">
<outline type="rss" text="Google News"
xmlUrl="http://news.google.com/news?q=%subject%&amp;output=rss" />
</grazr:formtemplate>

This style is called an outline template. Each feed's URL is entered within an outline template using the standard OPML syntax for an RSS node. This means that the URL is indicated with the xmlUrl attribute. An outline template is ended with the grazr:formtemplate tag. Each feed in an outline template is displayed as a separate node beneath the result.

To learn more about OPML and the RSS node syntax, you can read our OPML tutorial.

http://docs.grazr.com/script/tutorial/newsoutline.xml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0" xmlns:grazr="http://docs.grazr.com/script/spec/1.0">
<head>
<title>News Search</title>
</head>
<body>
<grazr:form name="newsform">
News Search <input type="text" name="subject" />
<input type="submit" value="Enter" />
</grazr:form>

<grazr:formtemplate name="newsform" >
<outline type="rss" text="Google News"
xmlUrl="http://news.google.com/news?q=%subject%&amp;output=rss" />
</grazr:formtemplate>

<grazr:formresult text="News Results:" name="newsform" />

</body>
</opml>


There is no limit on the number of feeds you can place in an outline template. Here's an example where the form input is substituted within three feeds:

http://docs.grazr.com/script/tutorial/newsoutline2.xml

<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0" xmlns:grazr="http://docs.grazr.com/script/spec/1.0">
<head>
<title>News Search</title>
</head>
<body>
<grazr:form name="newsform">
News Search <input type="text" name="subject" />
<input type="submit" value="Enter" />
</grazr:form>

<grazr:formtemplate name="newsform" >
<outline type="rss" text="Google News"
xmlUrl="http://news.google.com/news?q=%subject%&amp;output=rss" />
<outline type="rss" text="MSN.com"
xmlUrl="http://search.msn.com/news/results.aspx?q=%subject%&amp;format=rss&amp;FORM=RSNR" />
<outline type="rss" text="Yahoo.com"
xmlUrl="http://news.search.yahoo.com/news/rss?ei=UTF-8&amp;p=%subject%" />
</grazr:formtemplate>

<grazr:formresult text="News Results:" name="newsform" />

</body>
</opml>



Dealing with ampersandsWhere are the parts?