[Koha-devel] Koha Themes,

finlay at katipo.co.nz finlay at katipo.co.nz
Mon Oct 7 17:09:10 CEST 2002


Hi Everyone,

I writing this from sunny Queenstown, New Zealand. Sorry for being so out
of touch the last few days.

So what to do about the templating?

I think that we already have pretty much a consensus on what the plan is.

The information on Roger's Wiki at
http://www.saas.nsw.edu.au/wiki/index.php?page=ThemeHowTo

is all pretty much how I see it. Just to paraphrase:

1) all templates should live in koha-tmpl, along with there associated
includes and images (style sheets, javascripts, etc)

2) this cvs branch will eventually replace the koha-html tree all together.

3) under koha-tmpl there are two subtrees: intranet-tmpl/ and opac-tmpl/
corresponding to what should go into the <serverroot>/intranet/htdocs/ and
<serverroot>/opac/htdocs/ directories on the live sites.

4) under each of these are /<theme>/<lang>/ directories. Each theme can
have different language settings. At present I have been working only on
the /default/en/ templates.

5) Theme, language selection: In the scripts there should be the lines:

use C4::Output;
my $template = gettemplate("opac-search.tmpl", "opac");

The gettemplate subroutine looks for the theme and language settings,
looks for a template, loads the template and sets the <themelang> tag for
use in all the includes etc. I.e.

src="<TMPL_VAR NAME='themelang'>/images/search-button.gif"


This is the concessus right now. There are some other issues however:

Issue 1) Should we have a totally seperated html/website tree under each
/<theme>/<lang>/ directory ?

I think so. most, if not all of the includes and images are theme and
language specific. Anything that is not language specifc can go in the
/<theme>/<all>/ directory. I dont think there will be anything not theme
specific.


Issue 2) The "gettemplate" and "pathtotemplate"
subroutines in Output.pm ? why two and which to use?

There are two routines here because Dorian and I solved the same problem
at the same time :-) The key design difference is that gettemplate
actually loads the template and returns the template object. Whereas
pathtotemplate returns a path that can be use to load the template.

I think it is better to pass the template because it simplifies the script
code: getting the template involves only one line. If there are extra
options and settings that you want to pass to the HTML::Template->new()
call, they can be passed through a new improoved gettemplate sub. (not
hard to change.) however I cant image when you would want to do this, and
if so it would not be commen.

what do people think?

Issue 3) What to do about systempreferences etc. ? How does koha select
the theme and language?

There has been some disscussion on this which I will try and paraphrase.
Luckly the gettemplate routine doesnt really need to change at all so
changing our minds about this issue is easy :-)

At present there are two places for settings: the koha.conf file and the
systempreferences table in the database. Gettemplate gets the 'opachtdocs'
or 'intranethtdocs' settings in from the koha.conf file (through
C4::Context whis is really cool btw) and then looks into the
systempreferences table for the 'opaclanguages' and 'opacthemes' settings.
These can be space seperated lists in order of preference. the subroutine
then goes and looks in the directory for the specified files until it
finds one.

One option is to put everything in the database? another option is to have
new database tables "themes" and "languages" with IP and userid fields so
that settings can be kept between sessions and individual computers can
have different settings? I think this is desirable.


Issue 4) CSS ?

Roger has suggested using a template variable 'type' to switch between the
intranet and the opac. This, in my opinion, is a bad idea. I have been
trying to remove all the 'type = opac || intra' code from koha. The opac
and the intranet should use completely seperate code. all apart from the
modules (thus the "opac" in gettemplate("<tmplatename>.tmpl", "opac") )

However, there is no reason we can have heaps of CSS in the templated
koha. It just goes into files that are read in through
<TMPL_INCLUDE NAME="stylesheet"> tags.


Well thats about all for now.

I hope that is helping :-)

Finlay

ps. other issues?











More information about the Koha-devel mailing list