Re: Setting depth with the flav_config plugin

Stuart Langridge <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
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 :)

sil


-------------------------------------------------------
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.