Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [archived] tcm_rss - RSS feeds with any formatting
ah, in the meantime, I think that this article would be extremely useful :)
Last edited by tmacwrig (2004-11-24 00:40:04)
Offline
Re: [archived] tcm_rss - RSS feeds with any formatting
Mine is working fine, it’s a simple amendment to the code to set how many posts you want to display, though it’s hardcoded in rather than being an option you can call.
The only thing I’m having problems with is the posted date, I want to display the date the feed was published/last updated and possibly the date for every post in it if that’s feasible.
Anyone know how to do this?
cheers
LP
Offline
Re: [archived] tcm_rss - RSS feeds with any formatting
Okay, I’m almost finished with a revised version. What’s done so far:
- “limit” attribute
- cacheing (slightly modified from joewils’s code)
- Handles RSS 2.0 feeds better (grabs full HTML when possible)
- Handles post dates on RSS >= 1.0 feeds
- Better error handling with no form, no feed, etc
Here’s the final problem that I want to fix before releasing it: with RSS 2.0 feeds, the date is in a strange format, ex.
<pre>2004-12-02T09:46Z</pre>
I’ve already tried strtotime and gmmktime, with no success. Apparently this time format is incorrect for RSS 2.0, that it’s a problem with Movabletype, but I have no fix for it yet.
Any ideas guys?
Offline
Re: [archived] tcm_rss - RSS feeds with any formatting
-the format is ISO 8601, I still can’t figure out how to process it.
Offline
#17 2004-12-04 22:10:40
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [archived] tcm_rss - RSS feeds with any formatting
Use strptime and specify the format, something like "%Y-%m-%dT%H:%M"
, then use mktime or gmmktime.
I don’t think the ‘Z’ should be there, that should be the time zone. You might have to make several attempts using strptime with different formats – it’ll return false if the format doesn’t match.
Last edited by zem (2004-12-04 22:11:13)
Alex
Offline
Re: [archived] tcm_rss - RSS feeds with any formatting
thanks, but I think that strptime is only in the CVS version of PHP (it definitely isn’t defined on my system, and that’s what the php manual page says.)
Offline
Re: [archived] tcm_rss - RSS feeds with any formatting
Assuming the format is always the same, dump it to a variable then use some preg command(s) to strip it into a format you can use.
Or try this blighter I found on the php man pages:
function iso8601_date($time) {
$tzd = date(‘O’,$time);
$tzd = substr(chunk_split($tzd, 3, ‘:’),0,6);
$date = date(‘Y-m-d\TH:i:s’, $time) . $tzd;
return $date;
}
Last edited by longplay (2004-12-05 15:06:06)
Offline
#20 2004-12-14 04:33:39
- proph3t
- Member
- Registered: 2004-09-26
- Posts: 31
Re: [archived] tcm_rss - RSS feeds with any formatting
Can’t get it to work with my site, I did all the same stuff as Kossatsch did, but I used this .xml file:
http://www.casinoman.net/asp/rss/cmnews.xml
Is there something wrong with it?
edit: for a bit more info:
- Uploaded the lib folder and installed/activated plugin. <br />
- Inserted: < txp:tcm_rss feed=“http://www.casinoman.net/asp/rss/cmnews.xml” form=“default” limit=“3” / > into my page.<br />
- Refresh page and nothing shows at all.
Last edited by proph3t (2004-12-14 04:53:22)
Offline
#21 2004-12-14 04:55:51
- proph3t
- Member
- Registered: 2004-09-26
- Posts: 31
Re: [archived] tcm_rss - RSS feeds with any formatting
Fixed it!
Unfortunately the limit function isnt working…
Offline
Re: [archived] tcm_rss - RSS feeds with any formatting
Offline
Re: [archived] tcm_rss - RSS feeds with any formatting
Thanks to zem, the plugin is now downloadable.
Offline
#24 2004-12-22 22:15:49
- apo
- Member
- From: Germany
- Registered: 2004-10-27
- Posts: 53
Re: [archived] tcm_rss - RSS feeds with any formatting
anyone got an idea how to “sync” the charset a rss feed gives?
at our site we use utf-8 all over the site (given by htaccess, since there were problems with umlauts). but when including an rss that doesnt use utf-8, it gives umlaut-problems again…
Offline