Re: A simple question about ordering of posts

chombee <[email protected]> Sun, 31 Jan 2010 18:12:53 +0000
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <20100131181253.GA8350@kisimul>
On Sun, Jan 31, 2010 at 04:16:29PM +0000, Chris G wrote:
> > Or perhaps it could be a cb_entryparser plugin that changes the value of
> > 'template_name' in the entrydata dict if the request is for an index
> > view, using a different story template for index views and for permalink
> > pages. See:
> > 
> > http://pyblosxom.sourceforge.net/1.5/dev_writing_plugins.html#writing-an-entryparser
>
> Ah, it's 'template_name' in the 'entry' dictionary, I was looking for
> 'template' rather unsuccessfully.  No, just tried that, there's no
> 'template name' in there either.  I've just looked through the entry
> dictionary that you get in cb_story and there's no template, only the
> flavour.  There is a 'template' argument but that's the actual
> template as a string, maybe one could modif that and return in in the
> args. 

No, I'm talking about the entrydata dict that the parse method
implemented by a cb_entryparser plugin should return to pyblosxom. This
dict is not passed to your plugin from pyblosxom, your plugin creates
the dict from scratch and returns it to pyblosxom. Look at the parse
method in this example:

http://pyblosxom.sourceforge.net/1.5/dev_writing_plugins.html#writing-an-entryparser

It constructs and returns a dict `entrydata` with the keys 'title' and
'body'. You could also add any other keys you wanted to this dict, and
their values could be used by your flavours or your other plugins. And
you can add the 'template_name' key, which is used by pyblosxom:

"You can also specify the template to use by setting the "template_name"
variable in the returned dict. If the template specified doesn’t exist,
PyBlosxom will use the story template for the specified flavour."

So if you put 'template_name' = 'story-title-only' in the dict, then
pyblosxom will look for a template file called 'story-title-only' in
your flavour instead of using the default template file 'story'.

> It's just as easy to empty (or not) the 'body'.

Yeah, but I consider this solution less optimal. You might want your
items on your index views to appear different from how they look on
their permalink pages in ways other than just not having a body. Using
separate story templates for the two views is more flexible.


------------------------------------------------------------------------------
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
_______________________________________________
pyblosxom-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyblosxom-users