开发者

Python tags loop

开发者 https://www.devze.com 2023-01-10 12:02 出处:网络
How would you replace these tags with actual data: [|RSSITEMS:] [|RSSITEM:TITLE|] [|RSSITEM:CONTENT|] [|END:RSSITEMS|]

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

精彩评论

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