LibWeb::Themes::Default - Default HTML widgets and theme for libweb applications
No non-standard Perl's library is required.
LibWeb::Core
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.
-content
-border_color default is SITE_LIQUID_COLOR2,
-border_color
-bg_color default is SITE_BG_COLOR,
-bg_color
-align is the content's horizontal alignment; default is `left',
-align
-valign is the content's vertical alignment; default is `top',
-valign
-cellpadding is the distance between the content and the `border' of table, default is 2,
-cellpadding
-width default is 100%.
-width
Post:
Return a SCALAR reference to a formatted table in HTML.
bordered_titled_table()
-title=>, -content=> [, -title_space=>, -title_align=>, -border_color=>, -title_txt_color=>, -bg_color=>, -align=>, -valign=>, -cellpadding=>, -width=> ]
-title is a scalar,
-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_space
-title_align
-title_align default is `center',
-border_color default is SITE_1ST_COLOR,
-title_txt_color default is SITE_BG_COLOR,
-title_txt_color
-cellpadding is the distance between the content and the `border' of table, default is 1,
enlighted_titled_table()
-title=>, -content=> [, -title_space=>, -title_align=>, -title_bg_color=>, -title_txt_color=>, -title_border_color=>, -bg_color=>, -align=>, -valign=>, -cellpadding=>, -width=> ]
-title
-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_bg_color default is SITE_LIQUID_COLOR3,
-title_bg_color
-title_txt_color default is SITE_LIQUID_COLOR5,
-title_border_color default is SITE_LIQUID_COLOR5,
-title_border_color
-cellpadding is the distance between the content and the `border' of table, default is 1.
tabber()
-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=> ]
-tabs is an ARRAY reference to scalar or SCALAR reference
-tabs
-active is a number indicating which tab is currently active (count from 0)
-active
-active_color is the color for the active tab; default is SITE_1ST_COLOR
-active_color
-fade_color is the color for non-active tabs; default is SITE_LIQUID_COLOR3
-fade_color
-tab_padding is the distance between a tab's content to its border, either in pixel or percentage; default is 0
-tab_padding
-tab_width is the width of each tab, either in pixel or percentage; default is ( total_width / (2 * number of tabs) )
-tab_width
-gap_width is the distance between two adjacent tabs, either in pixel or percentage; default if 1%
-gap_width
-total_width is the width of the whole tabber, either in pixel or percentage; default is 100%
-total_width
-base is a SCALAR reference to HTML to be put under the tabs
-base
-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_height
-base_align default is `left'
-base_align
-left_stub is a SCALAR reference to HTML to be put to the left of the tabs
-left_stub
-right_stub is a SCALAR reference to HTML to be put to the right of the tabs
-right_stub
-left_stub_align is 'left', 'center' or 'right'; default is 'left'
-left_stub_align
-right_stub_align is 'left', 'center' or 'right'; default is 'right'
-right_stub_align
-left_stub_width is either in pixel or percentage, you may want to specify this if you specify -left_stub
-left_stub_width
-right_stub_width is either in pixel or percentage
-right_stub_width
Return a SCALAR reference to a formatted tabbing navigation bar in HTML format.
table()
-content=> [, -bg_color=>, -align=>, -valign=>, -width=> ]
titled_table()
-title=>, -content=> [, -title_space=>, -title_align=>, -title_bg_color=>, -title_txt_color=>, -bg_color=>, align=>, -valign=>, -cellpadding=>, -width=> ]
-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_bg_color default is SITE_1ST_COLOR,
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
To install LibWeb::CGI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LibWeb::CGI
CPAN shell
perl -MCPAN -e shell install LibWeb::CGI
For more information on module installation, please visit the detailed CPAN module installation guide.