Re: A simple question about ordering of posts
Chris G <[email protected]> Sun, 31 Jan 2010 22:20:45 +0000
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <20100131222045.GC31609@chris> |
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 ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com