Introduction into QuackNews Templates
QuackNews works by downloading RSS syndication files and combining them with the template files to generate the HTML web pages that make up the offline cache. The offline cache contains three type of pages;
The index page.
This page is the root of the offline cache and links to all of the feed index pages.
The feed index pages.
There is one of these pages for each feed downloaded. The feed index page displays information on each entry within the feed. The feed entry will link to the article page for that entry, if it has been downloaded.
The article pages.
If the user specifies it within the feed definition, QuackNews can download the actual web pages linked to the feed entries Within the syncing process. The page and it's linked resources (images, etc) are stored on the local device.
NOTE: This option can lead to a large amount of storage space being used.
The index and feed index pages are generated using two template pages each. One page creates the page framework, the other the items listed.
The four pages that make up a template are:
- index_page.html - This defines the framework for the QuackNews offline cache index page.
- index_item.html - This defines the framework for the individual items within the QuackNews offline cache index page.
- page.html - This defines the framework for the individual feed page.
- item.html - This defines the framework the individual news items within the feed page.
Each of these HTML files have a number of tokens that define where various values are placed. Where possible the meaning of a token has been kept consistant.
Global template tokens
There is only one globally available token that can be used within all the template files.
NOTE: This is not so needed now that objects are copied to the cache directory. This means that any external file referances can be local to the generated offline cache pages.
- [%TP] - Template Path. This can be used to place the path to the current template folder, i.e. /home/fred/QuackNews/Templates/Silver.
Index Page template
There is only one specific token available within index_page.html template file.
- [%I] - Replaced with the generated template HTML for the RSS Feeds.
Default Index Page Template:
<HTML>
<HEAD>
<TITLE>QuackNews Feed Index Page</TITLE>
</HEAD>
<BODY>
<H2>QuackNews Feed Index Page</H2>
[%I]
</BODY>
</HTML>
Index Item template
There are four tokens available within index_item.html template file.
- [%T] - Title of the RSS Feed
- [%L] - Link to the Feed page. This page lists the articles within the RSS Feed.
- [%I] - Replaced with the generated template HTML for the articles within the RSS Feed.
- [%C|<pos html>|<neg html>] - A conditional token that is replaced by either the positive or negative html depending on the value of the caching articles value.
Default Index Item Template:
<P>
<A href='[%L]'><H3>[%T]</H3></A>
</P>
Page template
There are four tokens available within page.html template file.
- [%T] - Title of the RSS Feed.
- [%D] - Description of the RSS Feed.
- [%I] - Replaced with the generated template HTML for the articles within the RSS Feed.
- [%C|<pos html>|<neg html>] - A conditional token that is replaced by either the positive or negative html depending on the value of the caching articles value.
Default Page Template:
<HTML>
<HEAD>
<TITLE>[%T]</TITLE>
</HEAD>
<BODY>
<H2>[%T]</H2>
[%I]
</BODY>
</HTML>
Item template
There are five tokens available within item.html template file.
- [%T] - Title of the article
- [%D] - Description of the article. This is usually an extract of the news article or can be the content of the whole article.
- [%L] - Link to the original webpage for the article. If these pages have been downloaded, this link will be to the locally stored version.
- [%P] - Publication date of the article (Only available for RDF and RSS 2.0).
- [%C|<pos html>|<neg html>] - A conditional token that is replaced by either the positive or negative html depending on the value of the caching articles value.
Default Item Template:
<P>
<A href='[%L]'><H3>[%T]</H3></A>
[%D]
</P>