CGI::AppBuilder::Frame is a configuration initializer.
SYNOPSIS
use CGI::AppBuilder::Frame;
my $ab = CGI::AppBuilder::Frame- >new(
'ifn', 'my_init.cfg', 'opt', 'vhS:a:');
my ($q, $ar, $ar_log) = $ab- >start_app($0, %ARGV);
print $ab- >disp_form($q, $ar);
This class provides methods for reading and parsing configuration files.
new (ifn = > 'file.cfg', opt = > 'hvS:')
This is a inherited method from CGI::AppBuilder. See the same method in CGI::AppBuilder for more details.
frame_set ($fr, $pr)
Input variables:
$fr - frame set definiton array reference. The $fr contains two
elements [$hr, $ar]:
$hr - a hash ref containing the frame set attributes
$ar - a array ref containing hash references defining each
frames in the frame set.
$pr - tag attribute array ref. It contains three elements:
class - CSS class name
attr - attribute string such as 'width=5 onChange=js_func'
hr - hash ref with key and value pairs. This will be obtained
from $fr for each frame set and frame.
pretty - whether to add line breaks
Variables used or methods called:
CGI::AppBuilder::Table
html_tag - generate HTML tags
CGI::AppBuilder::Message
echo_msg - display message
How to use:
The following shows how to define the frame array ($fr):
+-+----+ The following defines the left layout:
| | T |
| +----+ [{cols= >"150,*"},[
| | | {src= >"left.htm",name= >"L"},
|L| C | [{rows= >"100,*,50"},[
| | | {src= >"top.htm",name= >"T"},
| |----| {src= >"main.htm",name= >"C"},
| | B | {src= >"bottom.htm",name= >"B"}]]]
+-+----+ ]
In YAML, here is how it looks like:
---
cols: 150,*
- src: left.htm
name: L
- rows: 100,*,50
- src: top.htm
name: T
- src: main.htm
name: C
- src: bottom.htm
name: B
...
+-+------+ The following defines the left layout:
| | T |
| +----+-+ [{cols= >"150,*"},[
| | | | {src= >"left.htm",name= >"L"},
|L| C |R| [{rows= >"100,*,50"},[
| | | | {src= >"top.htm",name= >"T"},
| | | | [{cols= >"*,100"},[
| |----+-+ {src= >"main.htm",name= >"C"},
| | | {src= >"right.htm",name= >"R"}] ] ],
| | B | {src= >"bottom.htm",name= >"B"}]]
+-+----+-+ ]
In YAML, here is how it looks like:
---
cols: 150,*
- src: left.htm
name: L
- rows: 100,*,50
- src: top.htm
name: T
- cols: *,100
- src: main.htm
name: C
- src: right.htm
name: R
- src: bottom.htm
name: B
...
Here is the testing codes:
my $fr = [{cols= >"150,*"},[
{src= >"left.htm",name= >"L"},
[{rows= >"100,*,50"},[
{src= >"top.htm",name= >"T"},
{src= >"main.htm",name= >"C"},
{src= >"bottom.htm",name= >"B"}]
]]
];
my $pr = {pretty= >1};
print $obj- >frame_set($fr,$pr);
# the following is the result:
< FRAMESET cols='150,*' >
< FRAME src='left.htm' name='L' >
< FRAMESET rows='100,*,50' >
< FRAME src='top.htm' name='T' >
< FRAME src='main.htm' name='C' >
< FRAME src='bottom.htm' name='B' >
< / FRAMESET >
< / FRAMESET >
$pr- >{_frameset_count} = 0; # reset frame set counter
my $f2 = [ {cols= >"150,*"},[
{src= >"left.htm",name= >"L"},
[{rows= >"100,*,50"},[
{src= >"top.htm",name= >"T"},
[{cols= >"*,100"},[
{src= >"main.htm",name= >"C"},
{src= >"right.htm",name= >"R"}]
],
{src= >"bottom.htm",name= >"B"}]
]]
];
print $obj- >frame_set($f2,$pr);
# the following is the result:
< FRAMESET cols='150,*' >
< FRAME src='left.htm' name='L' >
< FRAMESET rows='100,*,50' >
< FRAME src='top.htm' name='T' >
< FRAMESET cols='*,100' >
< FRAME src='main.htm' name='C' >
< FRAME src='right.htm' name='R' >
< / FRAMESET >
< FRAME src='bottom.htm' name='B' >
< / FRAMESET >
< / FRAMESET >
Return: HTML codes.
This method generates HTML codes based on the information provided. This method is also called < I >frameset< / I >.
Product's homepage
Requirements:
· Perl