|
From: Chris G <cl...@is...> - 2010-01-31 22:20:55
|
On Sun, Jan 31, 2010 at 06:54:46PM +0000, chombee wrote: > On Sun, Jan 31, 2010 at 06:23:14PM +0000, chombee wrote: > > Having said all this, cb_entryparser doesn't really seem like the right > > callback for what you want to do. You don't really want to change how > > the entry is parsed from file, just how the entry is rendered. Maybe a > > cb_postformat plugin that adds a 'template_name' key to the entry_data > > dict. > > No, wait! I think you want the cb_story callback, the same one that the > readmore plugin uses. Like the readmore plugin does, you can get the > entry dict with: > > entry = args['entry'] > > then use 'bl_type' to see if we're dealing with an index or a permalink > page: > > if entry['bl_type'] == 'file': > # This is a 'file' page, showing a single entry. > pass > else: > # This is an index page (front page or year, month, day, or > # category etc. page) showing multiple entries. > entry['template_name'] = 'story-index' > > As a matter of fact, a 'use different story templates for file > pages and index pages' plugin would be much simpler and more flexible > than the readmore plugin. If you wanted to provide a preview or summary > text for each entry like the readmore plugin does, you could just use a > metadata field for that. > Thanks for all the thoughts, I'm just about off to bed now but I'll re-read tomorrow. I agree that switching templates makes more sense and is more flexible. -- Chris Green |