| LibWeb documentation | view source | Contained in the LibWeb distribution. |
LibWeb::Themes::Default - Default HTML widgets and theme for libweb applications
use LibWeb::Themes::Default;
my $theme = new LibWeb::Themes::Default();
my $tabs = [
'<A HREF="/"><IMG SRC="/img/icon_home.png">Home</A>',
'<A HREF="/reports">Featured reports</A>',
'<A HREF="/shopping">Best buy</A>',
'<A HREF="/log">Login</A>'
];
my $tabbed_navigation_bar =
$theme->tabber( -tabs => $tabs, -active => 2 );
my $stock_quotes =
$theme->bordered_table(
-content => [ $fetched_stock_quotes ]
);
my $weather =
$theme->bordered_titled_table(
-title => "Today's weather",
-content => [ $fetched_weather ]
);
my $back_issues =
$theme->titled_table(
-title => "Looking for back issues?",
-content => [ $back_issues_archive_list ]
);
my $news =
$theme->enlighted_titled_table(
-title => "Today's news",
-content => [ $fetched_news ]
);
Please see the synopsis of LibWeb::HTML::Default to see how those HTML constructs can be displayed.
This class provides several common table templates for HTML display. This allows Web application designers focus their efforts on the logic of programs; while Web page designers spend their efforts on customizing this default by ISAing this class, say LibWeb::Themes::Futuristic, and writing different themes. A sample MyTheme.pm is included in the distribution for your hacking pleasure.
The current version of LibWeb::Themes::Default is available at
http://libweb.sourceforge.net
Several LibWeb applications (LEAPs) have be written, released and are available at
http://leaps.sourceforge.net
Variables in all-caps (e.g. SITE_BG_COLOR) are those variables set through LibWeb's rc file. Please read LibWeb::Core for more information. Method's parameters in square brackets means optional.
bordered_table()
Params:
-content=> [, -border_color=>, -bg_color=>, align=>, -valign=>, -cellpadding=>, -width=> ]
Pre:
-content must be an ARRAY reference to elements which are
scalars/SCALAR references/ARRAY references to plain HTML. -border_color default is SITE_LIQUID_COLOR2, -bg_color default is SITE_BG_COLOR, -align is the content's horizontal alignment; default is `left', -valign is the content's vertical alignment; default is `top', -cellpadding is the distance between the content and the `border'
of table, default is 2, -width default is 100%.Post:
bordered_titled_table()
Params:
-title=>, -content=> [, -title_space=>, -title_align=>, -border_color=>, -title_txt_color=>, -bg_color=>, -align=>, -valign=>, -cellpadding=>, -width=> ]
Pre:
-content must be an ARRAY reference to elements which are
scalars/SCALAR references/ARRAY references to plain HTML. -title_space is the space ( ) prepended before (if
-title_align is `left') or append after (if -title_align is
`right') the title; default is 2, i.e. ` '. If
-title_align is `center', -title_space is always 0, -title_align default is `center', -border_color default is SITE_1ST_COLOR, -title_txt_color default is SITE_BG_COLOR, -bg_color default is SITE_BG_COLOR, -align is the content's horizontal alignment; default is `left', -valign is the content's vertical alignment; default is `top', -cellpadding is the distance between the content and the `border'
of table, default is 1, -width default is 100%.Post:
enlighted_titled_table()
Params:
-title=>, -content=> [, -title_space=>, -title_align=>, -title_bg_color=>, -title_txt_color=>, -title_border_color=>, -bg_color=>, -align=>, -valign=>, -cellpadding=>, -width=> ]
Pre:
-title is a scalar, -content must be an ARRAY reference to elements which are
scalars/SCALAR references/ARRAY references to plain HTML, -title_space is the space ( ) prepended before (if
-title_align is `left') or append after (if -title_align is
`right') the title; default is 2, i.e. ` '. It is always 0
if -title_align is `center', -title_align default is `center', -title_bg_color default is SITE_LIQUID_COLOR3, -title_txt_color default is SITE_LIQUID_COLOR5, -title_border_color default is SITE_LIQUID_COLOR5, -bg_color default is SITE_BG_COLOR, -align is the content's horizontal alignment; default is `left', -valign is the content's vertical alignment; default is `top', -cellpadding is the distance between the content and the `border'
of table, default is 1. -width default is 100%.Post:
tabber()
Params:
-tabs=>, -active=> [, -active_color=>, -fade_color=>, -tab_padding=>, -tab_width=>, -gap_width=>, -total_width=>, -base=>, -base_height=>, -base_align, -left_stub=>, -right_stub=>, -left_stub_align=>, -right_stub_align=>, -left_stub_width=>, -right_stub_width=> ]
Pre:
-tabs is an ARRAY reference to scalar or SCALAR reference -active is a number indicating which tab is currently active (count
from 0) -active_color is the color for the active tab; default is
SITE_1ST_COLOR -fade_color is the color for non-active tabs; default is
SITE_LIQUID_COLOR3 -tab_padding is the distance between a tab's content to its border,
either in pixel or percentage; default is 0 -tab_width is the width of each tab, either in pixel or percentage;
default is ( total_width / (2 * number of tabs) ) -gap_width is the distance between two adjacent tabs, either in pixel
or percentage; default if 1% -total_width is the width of the whole tabber, either in pixel or
percentage; default is 100% -base is a SCALAR reference to HTML to be put under the tabs -base_height is the height of -base, either in pixel or percentage;
default is 5. You do not want to specify this if you specify -base -base_align default is `left' -left_stub is a SCALAR reference to HTML to be put to the left of
the tabs -right_stub is a SCALAR reference to HTML to be put to the right of
the tabs -left_stub_align is 'left', 'center' or 'right'; default is 'left' -right_stub_align is 'left', 'center' or 'right'; default is 'right' -left_stub_width is either in pixel or percentage, you may want to
specify this if you specify -left_stub -right_stub_width is either in pixel or percentagePost:
table()
Params:
-content=> [, -bg_color=>, -align=>, -valign=>, -width=> ]
Pre:
-content must be an ARRAY reference to elements which are
scalars/SCALAR references/ARRAY references to plain HTML, -bg_color default is SITE_BG_COLOR, -align is the content's horizontal alignment; default is `left', -valign is the content's vertical alignment; default is `top', -width default is 100%.Post:
titled_table()
Params:
-title=>, -content=> [, -title_space=>, -title_align=>, -title_bg_color=>, -title_txt_color=>, -bg_color=>, align=>, -valign=>, -cellpadding=>, -width=> ]
Pre:
-content must be an ARRAY reference to elements which are
scalars/SCALAR references/ARRAY references to plain HTML, -title_space is the space ( ) prepended before (if
-title_align is `left') or append after (if -title_align is
`right') the title. It is always 0 if -title_align is `center'.
Default is 2, i.e. ` ', -title_align default is `center', -title_bg_color default is SITE_1ST_COLOR, -title_txt_color default is SITE_BG_COLOR, -bg_color default is SITE_BG_COLOR, -align is the content's horizontal alignment; default is `left', -valign is the content's vertical alignment; default is `top', -cellpadding is the distance between the content and the `border' of
table, default is 1. -width default is 100%.Post:
This release does not provide a lot of table templates and only a default theme is available. Hopefully more people can write more themes for LibWeb and make them available at http://libweb.sourceforge.net.
LibWeb::HTML::Error, LibWeb::HTML::Site, LibWeb::HTML::Default
| LibWeb documentation | view source | Contained in the LibWeb distribution. |