SYNOPSIS

  use Data::TreeDumper ;

  #-------------------------------------------------------------------------------

  my $style ;
  my $body = DumpTree
                (
                GetData(), 'Data',
                DISPLAY_ROOT_ADDRESS => 1,
                DISPLAY_PERL_ADDRESS => 1,
                DISPLAY_PERL_SIZE => 1,
                RENDERER =>
                        {
                        NAME => 'DHTML',
                        STYLE => \$style,
                        BUTTON =>
                                {
                                COLLAPSE_EXPAND => 1,
                                SEARCH => 1,
                                },
                        },
                ) ;


  print <<EOT;
  <?xml version="1.0" encoding="iso-8859-1"?>
  <!DOCTYPE html
       PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  >

  <html>

  <!--
  Automatically generated by Perl and Data::TreeDumper::DHTML
  -->

  <head>
  <title>Data</title>

  $style
  </head>
  <body>
  $body

  <p>
     <img src='http://www.w3.org/Icons/valid-xhtml10' alt='Valid HTML 4.01!' height="15" width='44' />
  </p>

  </body>
  </html>
  EOT

DESCRIPTION

Simple \s-1DHTML\s0 renderer for Data::TreeDumper.

Thanks to Stevan Little author of Tree::Simple::View for giving me the idea and providing some code I could snatch.

EXAMPLE

Check dhtml_test.pl for a complete example of two structure dumps within the same \s-1HTML\s0 file.

OPTIONS

Style

\s-1CSS\s0 style is dumped to $setup->{\s-1RENDERER\s0}{\s-1STYLE\s0} (a ref to a scalar) if it exists. This allows you to collect all the \s-1CSS\s0 then output it at the top of the \s-1HTML\s0 code.

my $style ; my $body = DumpTree ( ...

RENDERER => { NAME => 'DHTML', STYLE => \$style, }, ) ;

{\s-1RENDERER\s0}{\s-1NO_STYLE\s0} removes style section generation. This is usefull when you defined your styles by hand.

my $style ; my $body = DumpTree ( ...

RENDERER => { NAME => 'DHTML', NO_STYLE => 1, }, ) ;

Class

The output will use class 'data_tree_dumper_dhtml' for <li> and <ul>. The class can be renamed with the help of {\s-1RENDERER\s0}{\s-1CLASS\s0}. This allows you to dump multiple data structures and display them with a diffrent styles.

my $style ; my $body = DumpTree ( ...

RENDERER => { NAME => 'DHTML', CLASS => 'my_class_name', }, ) ;

Glyphs

Data::TreeDumper outputs the tree lines as \s-1ASCII\s0 text by default. If {\s-1RENDERER\s0}{\s-1NO_GLYPH\s0} and \s-1RENDERER\s0}{\s-1NO_STYLE\s0} are defined, no lines are output and the indentation will be the default <li> style. If you would like to specify a specific style for your tree dump, defined you own \s-1CSS\s0 and set the appropriate class through {\s-1RENDERER\s0}{\s-1CLASS\s0}.

Expand/Collapse

Setting {\s-1RENDERER\s0}{\s-1COLLAPSED\s0} to a true value will display the tree collapsed. this is false by default.

$setup->{RENDERER}{COLLAPSED}++ ;

If {\s-1RENDERER\s0}{\s-1BUTTON\s0}{\s-1COLLAPSE_EXPAND\s0} is set, the rendered will add a button to allow the user to collapse and expand the tree.

$setup->{RENDERER}{BUTTON}{COLLAPSE_EXPAND}

Search

If {\s-1RENDERER\s0}{\s-1BUTTON\s0}{\s-1SEARCH\s0} is set, the rendered will add a button to allow the user to search the tree. This is a primitive search and has no other value than for test.

Bugs

I'll hapilly hand this module over to someone who knows what he does :-)

Check the \s-1TODO\s0 file.

EXPORT

None

AUTHORS

Khemir Nadim ibn Hamouda. <[email protected]>

Staffan Maahle\*'n.

Copyright (c) 2003 Nadim Ibn Hamouda el Khemir and Staffan Maahle\*'n. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perlitself.

If you find any value in this module, mail me! All hints, tips, flames and wishes are welcome at <[email protected]>.

RELATED TO Data::TreeDumper::Renderer::DHTML…

Data::TreeDumper.