[%# # IMPORTANT NOTE # This documentation is generated automatically from source # templates. Any changes you make here may be lost. # # The 'docsrc' documentation source bundle is available for download # from http://www.template-toolkit.org/docs.html and contains all # the source templates, XML files, scripts, etc., from which the # documentation for the Template Toolkit is built. -%] [% META book = 'Library' page = 'Splash' %] [% WRAPPER toc; PROCESS tocitem title ="DESCRIPTION" subs = [ "Introduction", "Configuration", "Colours", "Style" ]; PROCESS tocitem title ="COMPONENT TEMPLATES" subs = [ "splash/text", "splash/table", "splash/row", "splash/cell", "splash/box", "splash/button", "splash/bar", "splash/hair", "splash/menu", "splash/menubar", "splash/panel", "splash/pane", "splash/tab", "splash/tabset", "splash/tabbox", "splash/tabsbox", "splash/tabspanel" ]; PROCESS tocitem title ="EXAMPLES" subs = []; PROCESS tocitem title ="AUTHOR" subs = []; PROCESS tocitem title ="VERSION" subs = []; PROCESS tocitem title ="COPYRIGHT" subs = []; PROCESS tocitem title ="SEE ALSO" subs = []; END %] [% WRAPPER section title="DESCRIPTION" -%]

NOTE: This documentation is incomplete, incorrect and outdated. The Splash! library is still evolving and subject to change. See the examples for a much more recent and accurate demonstration of use.

[% WRAPPER subsection title = "Introduction" -%]

The 'Splash' template library is distributed as part of the Template Toolkit. It can be found in the 'templates' sub-directory of the installation directory.

    /your/tt2/installation
    |
    +-- docs
    |      ...
    |  
    +-- images
    |      ...
    |
    +-- examples
    |      ...
    |
    +-- templates
        |
        +-- html
        |      ...
        +-- pod
        |      ...
        +-- splash     <<<< YOU ARE HERE
               ...

To use the Splash library, you first need to tell the Template Toolkit where to find the template files.

    use Template;
    my $tt2 = Template->new({
	INCLUDE_PATH => '/usr/local/tt2/templates',
    });

For a portable way to determine the installation 'templates' directory, you can use the 'Template::Config->instdir()' class method.

    use Template;
    my $tt2 = Template->new({
	INCLUDE_PATH => Template::Config->instdir('templates'),
    });

Note that you should set the INCLUDE_PATH to the 'templates' directory as shown here and don't be tempted to set the INCLUDE_PATH to 'templates/splash'. Many of the Splash! components use elements in the 'html' directory and contain directives of the form:

    [% tt_start_tag %] INCLUDE html/something [% tt_end_tag %].
[%- END %] [% WRAPPER subsection title = "Configuration" -%]

The 'splash/config' template defines a 'splash' hash array which contains numerous configuration items for the Splash library. You must PROCESS this template to ensure that the hash definition is imported into your calling template. An INCLUDE is not sufficient as it localises variables and prevents the 'splash' hash array from existing outside the splash/config template.

    [% tt_start_tag %] PROCESS splash/config [% tt_end_tag %]

Alternately, you can define the splash/config template as a PRE_PROCESS item when you create the Template processor.

    use Template;
    my $tt2 = Template->new({
	INCLUDE_PATH => Template::Config->instdir('templates'),
	PRE_PROCESS  => 'splash/config',
    });

You can modify the default configuration by creating your own PRE_PROCESS config file which loads the 'splash/config' and then tweaks the settings to your own preferences.

    my $tt2 = Template->new({
	INCLUDE_PATH => [ '/home/abw/tt2/templates',
		          Template::Config->instdir('templates') ],
        PRE_PROCESS => 'config'
    });

/home/abw/tt2/templates/config:

    [% tt_start_tag %] # load the 'splash' configuration
       PROCESS splash/config;
       
       # tweak values to personal preferences
       splash.images       = '/~abw/tt2/images/splash'
       splash.select.col   = 'leaf'
       splash.unselect.col = 'bud'
    [% tt_end_tag %]

The splash/config file includes some instructional comments on things you might like to tweak.

[%- END %] [% WRAPPER subsection title = "Colours" -%]

The Splash! library uses the colours defined in the html/rgb template. The 'rgb' hash defined therein is imported as the 'splash.rgb' hash.

    [% tt_start_tag %] INCLUDE splash/box col='grey75' [% tt_end_tag %]

See the examples for further enlightenment on using colour.

[%- END %] [% WRAPPER subsection title = "Style" -%]

There are two very primitive "styles" implemented called "select" and "unselect". These are used to indicate which item on a menu is selected, for example. Each style defines characteristics like background colour, font face, size and colour, text alignment, and so on.

The styles are implemented as hashes within the 'splash' hash. Many of the components respond to a 'style' variable being set and you can pass a direct reference to splash.select or splash.unselect (or your own styles). e.g.

    [% tt_start_tag %] INCLUDE splash/button 
	   content = "Unselected"
           style   = splash.unselect
    [% tt_end_tag %]
    [% tt_start_tag %] INCLUDE splash/button 
           content ="Selected"
           style   = splash.select
    [% tt_end_tag %]

Alternately, you can use the 'select' variable to indicate either of the inbuilt styles: splash.select or splash.unselect.

    [% tt_start_tag %] INCLUDE splash/button 
           content = "Unselected"
           select  = 0
    [% tt_end_tag %]
    [% tt_start_tag %] INCLUDE splash/button
           content = "Selected"
           select  = 1
    [% tt_end_tag %]
[%- END %] [%- END %] [% WRAPPER section title="COMPONENT TEMPLATES" -%]

This section describes some of the component templates in the Splash! library. This documentation is incomplete and may also be inaccurate in places. The examples in the 'examples' directory are likely to be a much better reference.

[% WRAPPER subsection title = "splash/text" -%]

Simple template to format text according to a selected/unselected style, adding links, etc.

    [% tt_start_tag %] INCLUDE splash/text
           content = 'Template Toolkit'
           link    = 'http://www.template-toolkit.org'
           select  = 0
           bold    = 1
    [% tt_end_tag %]

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/table" -%]

A thin wrapper around html/table, allowing a colour to be specified by name.

    [% tt_start_tag %] WRAPPER splash/table
           col   = 'aqua'
	   pad   = 4
           width = '100%'
    [% tt_end_tag %]
    <tr>
      <td>Foo</td>
      <td>Bar</td>
    </tr>
    [% tt_start_tag %] END [% tt_end_tag %]

Configuration items:

[%- END %] [% WRAPPER subsection title = "splash/row" -%]

Creates a row for an HTML table.

    [% tt_start_tag %] WRAPPER splash/table [% tt_end_tag %]
       [% tt_start_tag %] WRAPPER splash/row col='marine' [% tt_end_tag %]
       <td>Foo</td><td>Bar</td>
       [% tt_start_tag %] END [% tt_end_tag %]
       [% tt_start_tag %] WRAPPER splash/row col='aqua' [% tt_end_tag %]
       <td>Foo</td><td>Bar</td>
       [% tt_start_tag %] END [% tt_end_tag %]
    [% tt_start_tag %] END [% tt_end_tag %]

Configuration items:

[%- END %] [% WRAPPER subsection title = "splash/cell" -%]

Creates a cell for an HTML table.

    [% tt_start_tag %] WRAPPER splash/table + splash/row + splash/cell col='grey75' [% tt_end_tag %]
	Hello World
    [% tt_start_tag %] END [% tt_end_tag %]

Configuration items:

[%- END %] [% WRAPPER subsection title = "splash/box" -%]

A box created from a union of splash/table, splash/row and splash/cell. The following is equivalent to the previous example.

    [% tt_start_tag %] WRAPPER splash/box col='grey75' [% tt_end_tag %]
	Hello World
    [% tt_start_tag %] END [% tt_end_tag %]

Configuration items are as per the individual templates.

[%- END %] [% WRAPPER subsection title = "splash/button" -%]

Creates a small button with rounded corners.

    [% tt_start_tag %] INCLUDE splash/button
           content = 'Template Toolkit'
           select  = 1
           width   = '50%'
    [% tt_end_tag %]

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/bar" -%]

Creates a bar with rounded corners at either the top or bottom, and square corners on the other. Default has rounded at the top, set 'invert' to select bottom.

    [% tt_start_tag %] INCLUDE splash/bar
           content = 'Hello World',
           select  = 1
    [% tt_end_tag %]	

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/hair" -%]

Generates a frame enclosing the content within crosshair corners.

    [% tt_start_tag %] INCLUDE splash/hair
           content = 'Template Toolkit'
    [% tt_end_tag %]

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/menu" -%]

Creates a menu as a series of splash/button elements.

    [% tt_start_tag %] buttons = [ 
	  { text => 'One', link => 'one.html' }
          { text => 'Two', link => 'two.html' }
       ]
    [% tt_end_tag %]
    [% tt_start_tag %] INCLUDE splash/menu
           select = 2		# Two
    [% tt_end_tag %]

Configuration items:

[%- END %] [% WRAPPER subsection title = "splash/menubar" -%]

As above, but incorporated into a wider bar.

    [% tt_start_tag %] WRAPPER splash/menubar [% tt_end_tag %]
       Section Title
    [% tt_start_tag %] END [% tt_end_tag %]

Configuration items:

[%- END %] [% WRAPPER subsection title = "splash/panel" -%]

A table with a coloured edge.

    [% tt_start_tag %] WRAPPER splash/panel edge='black' fill='grey75' border=2 [% tt_end_tag %]
       <tr>
         <td>Hello World</td>
       </tr>
    [% tt_start_tag %] END [% tt_end_tag %]

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/pane" -%]

A union of splash/row + splash/cell.

    [% tt_start_tag %] WRAPPER splash/panel select=1 [% tt_end_tag %]
       [% tt_start_tag %] WRAPPER splash/pane col='grey75' [% tt_end_tag %]
          Hello World
       [% tt_start_tag %] END [% tt_end_tag %]
       [% tt_start_tag %] WRAPPER splash/pane col='grey50' [% tt_end_tag %]
          Hello Again
       [% tt_start_tag %] END [% tt_end_tag %]
    [% tt_start_tag %] END [% tt_end_tag %]
[%- END %] [% WRAPPER subsection title = "splash/tab" -%]

A simple button looking like a page tab.

    [% tt_start_tag %] INCLUDE splash/tab
           content = 'Option 1'
           col = 'aqua'
    [% tt_end_tag %]

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/tabset" -%]

A set of splash/tab components, similar to a menu.

Configuration items:

[%- END %] [% WRAPPER subsection title = "splash/tabbox" -%]

Add a splash/tab to the top of a splash/box.

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/tabsbox" -%]

Add a splash/tabset to the top of a splash/box.

Configuration items:

The following items default to the relevant style values:

[%- END %] [% WRAPPER subsection title = "splash/tabspanel" -%]

As per splash/tabsbox, but attached to a splash/panel instead of a splash/box.

[%- END %] [%- END %] [% WRAPPER section title="EXAMPLES" -%]

See the examples in the 'examples' sub-directory of the installation for comprehensive examples showing use of the Splash! library.

[%- END %] [% WRAPPER section title="AUTHOR" -%]

Andy Wardley <abw@andywardley.com>

[% ttlink('http://www.andywardley.com/', 'http://www.andywardley.com/') -%]

[%- END %] [% WRAPPER section title="VERSION" -%]

2.70, distributed as part of the Template Toolkit version 2.14, released on 04 October 2004.

[%- END %] [% WRAPPER section title="COPYRIGHT" -%]
  Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved.
  Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

[%- END %] [% WRAPPER section title="SEE ALSO" -%]

[% ttlink('Template::Library::HTML', 'Template::Library::HTML') -%]

[%- END %]