The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

flat tree, represented by single table with rows

DEMO:

my $a = [
        'opa',
        'tralala',
        'heyo',
        'yoyo',
        'didi',
        {
        LABEL => 'opa',
        DATA  => [
                   'tralala',
                   'heyo',
                   {
                   LABEL => 'sesssil',
                   DATA  => [
                            'tralala',
                            'heyo',
                            'yoyo',
                            'didi',
                            ],
                   },
                   'yoyo',
                   'didi',
                   ],
        },
        'heyo',
        'yoyo',
        ];

print html_ftree( $a, 'ARGS' => 'cellpadding=10 width=100% border=0' );

sub html_tabs_table

arguments: array_ref, opt_hash

array_ref is list of hash refs with this content:

LABEL          -- label text for the this tab handle
LABEL_TD_ARGS  -- further optional arguments for the label TD
TEXT           -- text to show when tab handle clicked
TEXT_TD_ARGS   -- TD element args, same as above
ON             -- if true, this tab will be initially visible
TAB_ID         -- html id for this tab

opt_hash is inline with the following items:

LABELS_TABLE_ARGS -- args for the table containing labels
TEXT_TABLE_ARGS   -- same as above

LABEL_CLASS_ON    -- active TD class for tab handle labels
LABEL_CLASS_OFF   -- inactive TD class for tab handle labels

ARGS              -- args for containing TABLE element
VERTICAL          -- if true, tabs will be vertical

ACTIVE_TAB_FORM_FEEDBACK_ID -- html INPUT element to hold active tab id

example:

my @tabs;

for my $z ( 1 .. 5 )
  {
  push @tabs, {
                LABEL         => "TAB $z",
                TEXT          => "$z " x 128,
                LABEL_TD_ARGS => "class=tab-label style='cursor: pointer;'",
                TEXT_TD_ARGS  => "class=tab-text",
              };
  }

$html = html_tabs_table( \@tabs, ARGS => "width=70% border=2", VERTICAL => 1 );