Using Templates and Language Files

From GeeklogWiki
Revision as of 15:29, 17 May 2009 by Dirk (talk | contribs) (added link to Translations page)

Jump to: navigation, search

Templates

Most of the Geeklog code has isolated all of the display HTML into templates using the template engine from Phplib. See http://phplib.sf.net. If you need some help on template usage see: http://www.phpbuilder.com/columns/david20000512.php3 and http://www.devshed.com/Server_Side/PHP/PHPLib/page1.html.

Geeklog's use of template files allows for the easy creation of themes. Your use of templates will make it easier to include your plugin or block in the theme system.


Language Files

Geeklog separates all the display language into separate language files so that the entire website can be translated without changing the code. The use of language files will allow your plugin or block to also be used worldwide without the changing of your code. Geeklog is used worldwide. The format of the Geeklog language file is a series of arrays, one for each of your display files in the following format:

$LANG_{plugin-name}XX[YY]:  $LANG - variable name
           XX - file id number
           YY - phrase id number (either numeric or string)

So that for a plugin called BAR you would have:

$LANG_BAR00 = array (
    'this'     => 'This',
    'that'      => 'That',
    'here'     => 'Here',
    'there'   => 'There'
);
or 
$LANG_BAR00 = array (
    1     => 'This',
    2     => 'That',
    3     => 'Here',
    4     => 'There'
);

Also see Translations.