package Blosxom::Plugin::theme; # TO INSTALL: # 1) name this file _theme.pm_ and place it in your B3 plugin folder; # 2) add this line to your handlers.flow file: # Blosxom::Plugin::theme::load_theme # just _after_ Blosxom::handle_handlers; # 3) copy your B2 themes folder into your B3 templates folder; # 4) edit your themes, changing <!-- blosxom story --> to <!-- blosxom entry -->; # 5) that should be it.... # # # # # # # # # # # Configuration # # # # # # # # # # # # you're best off putting your themes directory in your # templates dir. Just like 2.0 themes, the path should be # something like: /data/.templates/themes # Where do your themes live? my $theme_dir = ''; # leave empty for auto-configuration # # Just like 2.0 themes, the complete path to your theme files # should be something like: /data/.templates/themes/flavour_name/page # # # What's the URL of your themes directory? # This is vital for those themes that employ images, stylesheets, or other # external content pulled in from outside the page itself. # my $theme_dir_url = ''; # leave empty for auto-configuration # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # sub load_theme { my $self = shift; !$theme_dir and $theme_dir = "$self->{settings}->{find_entries_dir}/$self->{settings}->{templates_subdir}/themes"; !$theme_dir_url and $theme_dir_url = "$self->{request}->{url}/themes"; use FileHandle; my $fh = new FileHandle; if ($fh->open("$theme_dir/$self->{request}->{flavour}/page")) { my $str = ''; my $component_name = ''; while (my $line = <$fh>) { # get a match on component-tag within $line: $line =~ /<!--\s*blosxom\s+(\w+)(?:\s+(.*)\b)?\s*-->/; # if both refs have value, we've got the content-type component: $1 and $2 and $self->{templates}->{ $self->{request}->{flavour} }->{$1} = $2 and next; # or, if we've got a component name, start a template entry: $1 and $component_name = $1 and next; # otherwise, add to the current template component: $self->{templates}->{ $self->{request}->{flavour} }->{$component_name} .= $line; } close $fh; $self->{settings}->{theme_dir} = $theme_dir; $self->{settings}->{theme_dir_url} = $theme_dir_url; } 1; } 1; _ _ END _ _ # squish the END statement together (no spaces); # the wiki formatting seems to preclude a proper END ;-)