mySkin.php

The second step in making a skin is to create a PHP class file, inside the skin folder. The minimum code you can use, is the following:

<?php
class zSkinMySkin extends zSkinBase
{
    public
    function __construct($INFO)
    {
    	parent::__construct($INFO);

        parent::set_style('', array(
            // define style variables here
            ));
    }
}

You can copy/paste the above code as is, only changing “MySkin” to whatever name your actual skin is. Please have in mind that the uppercase “M” (in the class name) is not a typo. Zoglair classes are named after the file in which they are defined, capitalizing the first letter of each path component.

At this point, you have a fully qualified and working skin. Obviously, it will look exactly like zoglair's default skin, but it will be selectable as “mySkin” instead of “default”.

The parent::set_style() function takes 2 arguments:

  • the style's name
  • an array of style variables

If you pass an empty string as a style name, then “default” will be assumed. This is the proper method to define the first style of a skin. Subsequent calls of parent::set_style() must pass a valid style name in the first argument.

The style variables can be either existing ones (used by the default skin) or your own. In other words, you can overwrite any of the existing variables and define any new ones, obviously used in your CSS.

For example:

<?php
        ...
        parent::set_style('', array(
            'main_width' => '704px',
            'view_bg'    => 'url({{'.zoglair::Z_MID_VIEW_BG.'|:url}})',
            'body_bg'    => '#F7F2DC url({{5|:url}}) no-repeat',
            ));

You can find out the default style variables either by reading <zoglair>/skin/base.php or by clicking on your toolbar.

(C) Nick B. Cassos - All Rights Reserved
powered by zoglair
page generated in 25ms (11 queries, 5ms)