Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-17 06:30:06

DrSlump
New Member
From: Spain
Registered: 2004-09-05
Posts: 3
Website

A better way to publish the feeds

Hi,

I like TextPattern because of the freedom I have to make my sites look as I really want to. It accomplishes a quite good separation of content from presentation, however it’s assumed that we always want to publish HTML.

The idea is to make a small change in the section handling, just a new attribute which allows to set the HTTP Content-type. This way, we could for example, publish our ATOM or RSS feeds in a customized version by the use of custom ‘pages’ and ‘forms’.

An example ‘page’ for Atom:
<pre><code>
&lt;?xml version=“1.0” encoding=“utf-8”?>
&lt;feed xmlns=“http://www.w3.org/2005/atom”>

&lt;title>&lt;txp:page_title />&lt;/title> &lt;subtitle>&lt;txp:sitename />&lt;/subtitle> &lt;link href=”&lt;txp:site_url />” /> &lt;updated>2006-07-17T10:00:00Z&lt;/updated> &lt;author> &lt;name>DrSlump&lt;/name> &lt;email>dr_nospam_slump@drslump.biz&lt;/email> &lt;/author> &lt;id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6&lt;/id> &lt;txp:article_custom form=“atom_article” limit=“10” section=“blog” /> &lt;/feed> </code></pre>

and the example ‘form’:
<pre><code>
&lt;entry> &lt;title>&lt;txp:title />&lt;/title> &lt;link href=”&lt;txp:permlink />” /> &lt;id>&lt;txp:permlink /></id> &lt;updated>2006-07-12T10:00:00Z&lt;/updated> &lt;summary>&lt;txp:body />&lt;/summary>
&lt;/entry>
</code></pre>

With this aproach it’s much simpler to customize the feeds, since we can modify them from the admin interface, taking advantatge of the available plugins.

Besides the feeds, we can also implement simple web services using this aproach. Moreover, all the data is always plublished thru a unique pipeline, so cache solutions for the html content will also work for the other formats.

ciao,
ivan

Offline

#2 2006-07-17 16:01:46

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: A better way to publish the feeds

I like this idea, it’s very similar to how other projects deal with feeds.

Offline

Board footer

Powered by FluxBB