Re: Setting depth with the flav_config plugin

will guaraldi <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On Sun, 5 Dec 2004, Stuart Langridge wrote:
> 
> will guaraldi wrote:
>>
>> I see what you're doing.  You don't want to override the 404 because 
>> the 404 has a specific meaning, you just want to handle the case where 
>> there aren't any entries.  So you should do a callback that uses the 
>> prepare hook and checks to see if there are no entries and the user is 
>> looking at photos.  If that's the case, then it should create an entry 
>> with the message you have above.
>
> OK, one more question (and then possibly I can leave you in peace to 
> hack on 1.1 :-)
>
> What's the best way of putting a little bit of interactivity into my 
> templates? Specifically, if statements.
>
> You see, my story.html template, for my photo weblog, looks like this:
>
> <a href="/$absolute_path/$yr/$mo_num/$da/$basename"><img 
> src="/gallery/$absolute_path/thumb.$fn"></a>
>
> A page showing one photo has a permalink of 
> /photos/category/2004/12/05/photoname. Obviously, a link to a 
> subcategory needs the permalink /photos/category/subcategory, which will 
> break if I insert an entry into entry_list which is actually a 
> subcategory (but is pretending to be a photo). So what I'd like to do in 
> story.html is this:
>
> if ($entry_type == "entry")
>    <a href="/$absolute_path/$yr/$mo_num/$da/$basename"><img
>    src="/gallery/$absolute_path/thumb.$fn"></a>
> elif ($entry_type == "subcategory")
>    <a href="/$absolute_path">Subcategory: $basename</a>
>
> but obviously I can't currently do that. I *could* implement this in 
> cb_prepare by giving each entry a "permalink" attribute, and giving the 
> faked "there is a subcategory here" entries an appropriate "permalink" 
> attribute that links to the subcategory. This would mean that story.html 
> looked like this:
>
> $permalink
>
> but it seems....crufty? And a lot more difficult to customise. Is there 
> a way, short of changing pyblosxom so that I'm actually using 
> CheetahTemplate or something to render pages, to do this?
>
> Sorry about all the questions...I will be be documenting all the stuff 
> that I do to get all this working :)

Don't worry about asking questions.  I'd rather you asked questions then 
got annoyed and went off into the world, wrote a steaming blog entry, and 
then started writing your own blog server.

I think Cheetah template rendering would be really slick and something 
that at least a few people would be interested in.

The easy way to do this is to write a renderer plugin that handles 
CheetahTemplates.  You should look at the base renderer class and get a 
feel for how PyBlosxom interfaces with the renderer.  After that, it 
should be pretty easy to implement--especially if you've already used 
Cheetah templates before.

It'd further be interesting to do it all in one big template file rather 
than split it up into a bunch of little template files.  That's a feature 
that I think blosxom 3.0 has that we don't have yet.  It's something I'm 
interested in looking into.

If you have problems, poke me.  I've never used Cheetah before, but I'd be 
interested in helping out in this regard.

/will


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.