开发者

Python tags loop

How would you replace these tags with actual data:

[|RSSITEMS:]

[|RSSITEM:TITLE|]
[|RSSITEM:CONTENT|]

[|END:RSSITEMS|] 

[|RSSITEMS:] starts loop at the top and ends its [|END:RSSITEMS|]

[|RSSITEM:TITLE|] and [|RSSITEM:CONTENT|] shoul开发者_运维知识库d be replaced with data from rss feeds.

Feed data is already in database.

Can not use django templates, as HTML above will be different in most cases, can not use templates. the HTML is stored in database.


Maybe you could use an existing template engine instead, such as Cheetah (example) or the one from Django (example with for loop).


Don't use custom templates for RSS. There is a syndication framework:

http://docs.djangoproject.com/en/dev/ref/contrib/syndication/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜