Categories Plugin 0+4i

Categories has been updated.

User-visible Interesting Changes, in rough order by interestingness:

  • new $indent template variable, which is the contents of the flavour file 'indent', repeated N times, where N is the depth of the current category
  • new template variable "$prettydir", is the name of the category with spaces added to CamelCaps and instead of underlines in underlined_names.
  • The top-level directory is now called "Root" by default, not "/", and it's configurable
  • uses the built-in templating system, including any template plugin that's installed
  • variables in templates can be interpolated with ${name} as well as $name
  • cached layouts are keyed based on flavour, so if you have template files that vary by flavour it will actually work now
  • cache is only enabled if the available Storable supports lock_retrieve
  • the cache is flushed every time a story is added, not every time the timestamp of the latest file changes; if caching is enabled, the category list (usually) now shows all the categories even if a filtering plugin (such as a search system) has reduced the number of visible files.
  • the $story_count_commulative configuration variable is now spelt $story_count_cumulative, to match the actual english language. Attempts to get enlish to change to match the plugin were unsuccessful.
  • requires Blosxom 2.0rc1 2.0rc2 or newer
  • the default templates are in the 'error' flavour rather than 'html', so they're used for any flavours that don't override them (the same effect was achieved a different way in 0+4i)

Thanks to:

  • Jason Hoffman, prodding me into XHTML validation
  • Robert Hahn, for the directory-name prettification
  • Colin Eric Johnson, for an HTML validation note
  • Earle Martin, HTML validation note

Things I'd like to be able to do, but can't reasonably without Blosxom changes:

  • use the built-in interpolation system, including any interpolate plugin that's installed

To install:

  1. download and unzip the plugin.
  2. Copy it to your plugins directory. Make sure it's world-readable.
  3. Modify a head or foot file to include $categories::categories or $categories::breadcrumbs
  4. Try it out — load your blog in your browser. If you see a category tree, great!
  5. Look at your error log. Verify you have an 'enabled' line.
  6. If you're wanting to verify caching is working, load the page again, and now look for an error log line "calendar debug 1: Using cached state"
  7. Once you're satisfied it's working, edit the $debug_level configuration variable to 0. There are a couple other configuration variables you may wish to change, too.
  8. Drop me a note to let me know you're using it; if you're having problems, let me know and I might be able to help. If everything's working okay, please let me know that, too.

Molelog is running this with some customized templates.

categories.breadcrumb_between_child.html:

|​

categories.head.html:

<form name="cat" method="get" action="$url"> 
<!-- XXX any way to do this w/o js? -->
<script type="text/javascript">
function gotocat() {
 location = document.cat.cat.options[document.cat.cat.selectedIndex].value;
}
</script>
<select name="cat" onchange="gotocat()">

categories.indent.html:

&nbsp;&nbsp;&nbsp;

categories.dir_head.html:

<option value="$url/index.html">
  $indent$prettydir /
</option>

categories.this_dir_head.html:

<option selected value="$url/index.$blosxom::flavour">
  $indent$prettydir /
</option>

categories.foot.html:

</select></form>

categories.dir_foot.html, categories.subtree_head.html, categories.subtree_foot.html, categories.this_dir_head.html, and categories.this_dir_foot.html are all empty.

2003-03-25 15:33:00 | Comments (9) | TrackBack (0) | Computers::Internet::Web::Blosxom::Plugins::Categories

Trackback Pings

TrackBack URL for this entry:
http://molelog.molehill.org/~jtl/mt/mt-tb.cgi/495

Comments

aufrank

todd—

any chance that categories could notice the files/directories in a .exclude file? ideally, it would not report them, and would not add their story counts to the total for the whole tree. if this would be easier to do with the cvsignore plugin, that’d work too.

thanks,
/au

2003-07-14 11:07:00

Todd Larason

It automatically works, if you rename the plugins to force exclude to run before categories — ie ‘10exclude’ and ‘20categories’

2003-07-14 14:31:00

aufrank

It does just work initially when I’ve got it set to 10exclude and 20categories— that was the setup I had going from the beginning. However, as soon as you visit one of the excluded directories, all excluded directories are added to the tree, and their story counts are added to the total for the root directory.

This happens with caching turned as well as with caching turned off.

2003-07-14 22:37:00

Todd Larason

Ugh. I really really don’t think Categories should be handing the .exclude file itself. I’ll think about this some more.

2003-07-15 03:39:00

Jim Phelps

Great plugin. Works with the exclude plugin as described above. I have a question though. If you look at my blosxom log, you’ll see the categories listed on the side. The top category is already indented quit far so everything is scrunched to the right. You can also see this on http://arch.doit.wisc.edu/index.cgi.

Is there a way to control how far over the listing starts (Farther to the left side by a tab stop or two)?

Thanks,

Jim (email me at phelps AT doit.wisc.edu)

2003-10-03 17:25:00

Numbski

I don’t get it.

If you look at http://www.numbski.net , and look at the $categories::categories listing on the left-hand side.…look at the links.

It’s appending index.ico to the end of every listing. I don’t even have an index.ico file in any of those directories (that I’m aware of…). Any idea as to what might be going on?

2005-01-13 14:41:00

Jon

I like this plugin a lot - it’s no hassle, drop-in; however the nesting of UL and LI elements is broken. You can’t have a UL inside a UL directly: it needs to be a list-element of the parent UL. I‘m looking at fixing this myself.

2005-03-13 04:54:00

Jon

37,38c37,38
< return qq!<li><a href=”$blosxom::url${fulldir}index.$blosxom::default_flavour”>$thisdir</a>! .
< qq!($numstories)</li>\n<ul>\n!
—-
> return qq!<li><a href=”$blosxom::url${fulldir}”>$thisdir</a>! .
> qq!($numstories)</li>\n<li><ul>\n!
48c48
< return qq!<li><a href=”$blosxom::url${fulldir}index.$blosxom::default_flavour”>$thisdir</a>! .
—-
> return qq!<li><a href=”$blosxom::url${fulldir}”>$thisdir</a>! .
57c57
< return qq!</ul>\n! if $output_format eq ‘ul’;
—-
> return qq!</ul></li>\n! if $output_format eq ‘ul’;

2005-03-13 05:01:00

Jon

Yeah you may notice that patch does more than I advetised. Ignore the bits which modify the href :)

2005-03-13 05:04:00

Post a comment




Remember Me?

(you may use HTML tags for style)