Getting Started

How to get started with your first template

This simple tutorial will demonstrate how to manage your pirum server with your own template.

Pirus comes with the same features as Pirum, which is almost the same code. Pirus add ability to handle your own templates easily, with a sample configuration file.

This configuration file is named pirum.ini (for windows users), and .pirumrc (for linux users).

Don’t be confused, between the two names Pirum and Pirus. Pirus 2.0 is only the behavior missing to Pirum 1.x

It’s the same interface, commands, as Pirum. After all it’s not a surprise, because Pirus 2 is a forked code of Pirum 1.1.5-dev

To handle multiple server and different graphical theme, it’s a pain and a maelstrom to do it with Pirum. You have to switch from a copy of your templates/ directory to another.

With Pirus 2.0 and a simple INI file, that should exist in the same directory as the pirus script itself, like that :

[pirum]
template = default
templatedir = templates

;[/path/to/your/pear/channel/server]
;template = subfolder_of_templatedir
;templatedir = /path/to/your/templates

You have the same behavior as Pirum 1.1.4

This INI file is only a list of section, where each one define a single server and it’s location (on your file system), and the theme (template) to apply.

Only two easy steps are required.

  • First, write a simple INI content file like the one below and named it following the platform rules : pirum.ini (for windows users), and .pirumrc (for linux users). It must be located in the same directory as pirus executable.

  • Second, just use pirus command rather than pirum

Default Configuration File Pattern
[pirum]
template = default
templatedir = templates

As Pirum, to get you started, you can copy and paste the default templates found in the buildIndex() and buildCss() methods. Or just copy the default theme in the templates/default directory of Pirus.

Suppose your PEAR Channel Server is locate in /var/pirum/servers/mypearchannel, you’ve named it mypearchannel and you named the theme lightgreen.

Your configuration file should look like this one :

[pirum]
template = default
templatedir = templates

[/var/pirum/servers/mypearchannel]
template = lightgreen

In summary, your new file system structure will be :

  +-- pirus
  +-- templates/
      +-- default/        1
      |   +-- index.html
      |   +-- pirum.css
      +-- lightgreen/     2
          +-- index.html
          +-- pirum.css
1 The default theme of Pirum
2 You own templates html and stylesheet

If you want to separate location of your different themes and servers, you can use another templatedir directive to do so.

Split templates directory in two groups : distribution files and your own files

[pirum]
template =
templatedir = templates

[/var/pirum/servers/myfirstpearchannel]
template = lightgreen
templatedir = /var/pirum/templates

[/var/pirum/servers/mysecondpearchannel]
template = ocean
templatedir = /var/pirum/templates

Your file system will look like :

  /usr/local/php/pear/
    +-- pirus
        +-- templates/        1
            +-- index.html
            +-- pirum.css

  /var/pirum/templates/
    +-- lightgreen/           2
    |   +-- index.html
    |   +-- pirum.css
    +-- ocean/                3
        +-- index.html
        +-- pirum.css
1 The default theme of Pirum
2 lightgreen theme for your PEAR Channel Server
3 ocean theme for your PEAR Channel Server

The PEAR Bartlett Channel is the first one that use Pirus.

images/bartlett_skin.png

http://bartlett.laurent-laville.org/

bartlett template is based on the Pirum default template.

images/default_skin.png

http://pear.pirum-project.org/