Customizing default templates
Pirum generates an index.html
and an pirum.css
file at the PEAR Channel Server root directory.
You can customize the templates used to generate those files by creating a templates/
directory.
This directory must be in the same directory as the pirum file.
To avoid this location limit, and allow to handle an unlimited count of theme template, here is the purpose of this Pull Request.
-
to keep goal to have only one file to install without dependencies, the default css and html contents where kept as fallback if external templates are not available.
-
we can change default location of templates.
-
we can specify a theme for each PEAR Channel Server (target_dir)
On current version of Pirum, we have such structure :
pirum
templates/
index.html
pirum.css
To do so, you have to create in the same directory as the script pirum
, a configuration file
named pirum.ini
(for windows) and .pirumrc
(for linux).
A basic configuration file that is equals to current behavior of Pirum is as follow :
[pirum]
template =
templatedir = templates
If you want to change default location of templates directory, and group by theme (in subfolders), you will perharps have something like :
[pirum]
template = default
templatedir = /var/pirum/templates
That means, all templates are now search in /var/pirum/templates
directory by default rather than templates
,
and the default theme (provided also as a fallback in buildCss()
and buildIndex()
)
is available on default
subfolder of templatedir.
Now if you want to use a theme named lightgreen
about your PEAR Channel Server ( target_dir = /www/mypearchannel )
You could have perharps a configuration file with such contents.
[pirum]
template = default
templatedir = /var/pirum/templates
[/www/mypearchannel]
template = lightgreen
/var/pirum/templates
default/ <1>
index.html
pirum.css
lightgreen <2>
index.html
pirum.css
You have ability to split templates in multiple directories, like that :
[pirum]
template =
templatedir = templates
[/www/mypearchannel]
template = lightblue
templatedir = /var/pear/servers/templates
/etc/pear/
pirum
templates/ <1>
index.html
pirum.css
/var/pear/servers/templates
lightblue <2>
index.html
pirum.css