Changeset 530


Ignore:
Timestamp:
Oct 10, 2004, 10:29:50 PM (17 years ago)
Author:
Dominic Hargreaves
Message:

Change custom template locations.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Build.PL

    r529 r530  
    207207            variable => "template_path",
    208208            value    => $val . "/templates" };
     209        push @answers, {
     210            question => "where should I look for custom templates?",
     211            variable => "custom_template_path",
     212            value    => $val . "/custom-templates" };
    209213    }
    210214}
  • trunk/CUSTOMISATION

    r529 r530  
    44
    55From OpenGuides 0.41, some of the supplied templates will optionally
    6 call out to other template fragments that you can put in
    7 templates/custom/.  If custom templates do not exist then sensible
    8 default wording will be used instead.
     6call out to other template fragments that you can put in a custom template
     7path (by default custom-templates/). If custom templates do not exist then
     8sensible default wording will be used instead.
     9
     10The names of all custom templates will be prefixed with custom_.
    911
    1012The custom templates currently supported are:
    1113
    12  - licence.tt
     14 - custom_licence.tt
    1315   Will be included at the top of the page editing form.
    1416
    15  - footer_credits.tt
     17 - custom_footer_credits.tt
    1618   Will be included in a <div id="footer"> at the base of every page.
    1719   You may wish to take advantage of the supplied TT variables
     
    2224       Contains the version of OpenGuides that your site is running on.
    2325
    24  - banner.tt
     26 - custom_banner.tt
    2527   Will be included in a <div id="banner"> at the top of every page.
    2628   You may wish to take advantage of the supplied TT variables
     
    3032Requests for further custom inserts are welcomed.
    3133
     34You can also include your own versions of other templates in the
     35custom-templates/ directory, and these will override the installed files,
     36but this is not recommended for the reasons detailed above.
  • trunk/Changes

    r529 r530  
    44        Fixed bug with paging on distance-only search (reported by Bob Walker).
    55        Improved encapsulation in OpenGuides::Supersearch - accessors.
     6        *INCOMPATIBLE CHANGE* Custom templates are now stored in
     7          user-definable path, and their names are prefixed with custom_.
     8          This only affects you if you have used the custom template support
     9          introduced in 0.41.
    610
    7110.41    21 September 2004
  • trunk/INSTALL

    r529 r530  
    167167Once you have installed OpenGuides you may wish to edit templates that
    168168provide site-specific design. These templates are stored in the directory
    169 templates/custom and are described in the file CUSTOMISATION. The id and
     169custom-templates/ and are described in the file CUSTOMISATION. The id and
    170170class tags used for the CSS in OpenGuides are specified in README.CSS.
    171171
  • trunk/lib/OpenGuides/Build.pm

    r529 r530  
    5454
    5555    # Install the scripts where we were told to.
    56     my $install_directory = $config->{_}->{install_directory};
    57     my $script_name       = $config->{_}->{script_name};
    58     my $template_path     = $config->{_}->{template_path};
    59     my $custom_lib_path   = $config->{_}->{custom_lib_path};
    60     my @extra_scripts     = @{ $self->{config}{__extra_scripts} };
    61     my @templates         = @{ $self->{config}{__templates} };
     56    my $install_directory    = $config->{_}->{install_directory};
     57    my $script_name          = $config->{_}->{script_name};
     58    my $template_path        = $config->{_}->{template_path};
     59    my $custom_template_path = $config->{_}->{custom_template_path};
     60    my $custom_lib_path      = $config->{_}->{custom_lib_path};
     61    my @extra_scripts        = @{ $self->{config}{__extra_scripts} };
     62    my @templates            = @{ $self->{config}{__templates} };
    6263
    6364    print "Installing scripts to $install_directory:\n";
     
    103104    }
    104105
    105     print "Installing templates to $install_directory/templates:\n";
     106    print "Installing templates to $template_path:\n";
    106107    foreach my $template ( @templates ) {
    107108        if ( $FAKE ) {
    108             print "templates/$template -> $install_directory/templates/$template (FAKE)\n";
     109            print "templates/$template -> $template_path/$template (FAKE)\n";
    109110        } else {
    110             $self->copy_if_modified("templates/$template", $install_directory)
    111                 or print "Skipping $install_directory/templates/$template (unchanged)\n";
     111            $self->copy_if_modified(from => "templates/$template", to_dir => $template_path, flatten => 1)
     112                or print "Skipping $template_path/$template (unchanged)\n";
    112113        }
    113114    }
     115    print "Making sure that $custom_template_path exists.\n";
     116    mkdir $custom_template_path or warn "Could not make $custom_template_path";
    114117}
    115118
  • trunk/lib/OpenGuides/Template.pm

    r529 r530  
    109109    my $config = $args{config} or croak "No config supplied";
    110110    my $template_path = $config->{_}->{template_path};
    111     my $tt = Template->new( { INCLUDE_PATH => $template_path } );
     111    my $custom_template_path = $config->{_}->{custom_template_path} || "";
     112    my $tt = Template->new( { INCLUDE_PATH => "$custom_template_path:$template_path" } );
    112113
    113114    my $script_name = $config->{_}->{script_name};
  • trunk/templates/banner.tt

    r529 r530  
    11<div id="banner">
    22  [% TRY %]
    3     [% INCLUDE custom/banner.tt %]
     3    [% INCLUDE custom_banner.tt %]
    44  [% CATCH %]
    55    <h1><a href="[% home_link %]">[% site_name %]</a></h1>
  • trunk/templates/edit_form.tt

    r529 r530  
    2020    <tr>
    2121      <td colspan="2">
    22         [% INCLUDE custom/licence.tt %]
     22        [% INCLUDE custom_licence.tt %]
    2323      </td>
    2424    </tr>
  • trunk/templates/footer.tt

    r529 r530  
    1616
    1717  [% TRY %]
    18     [% INCLUDE custom/footer_credits.tt %]
     18    [% INCLUDE custom_footer_credits.tt %]
    1919  [% CATCH %]
    2020    <p>
Note: See TracChangeset for help on using the changeset viewer.