Difference between revisions of "Using Templates and Language Files"

From GeeklogWiki
Jump to: navigation, search
m (fixed & prettyfied links)
m (Cosmetics)
 
Line 18: Line 18:
  
 
$LANG_BAR00 = array (
 
$LANG_BAR00 = array (
     'this'     => 'This',
+
     'this'   => 'This',
     'that'     => 'That',
+
     'that'   => 'That',
     'here'     => 'Here',
+
     'here'   => 'Here',
 
     'there'  => 'There'
 
     'there'  => 'There'
 
);
 
);
 +
 
or  
 
or  
 +
 
$LANG_BAR00 = array (
 
$LANG_BAR00 = array (
 
     1    => 'This',
 
     1    => 'This',

Latest revision as of 14:31, 8 June 2009

Templates

Most of the Geeklog code has isolated all of the display HTML into templates using the template engine from PHPLib. If you need some help on template usage see Templates, The PHPLIB Way and PHPLib Templates.

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.