NAME¶
Data::TreeDumper::Renderer::DHTML - DHTML renderer for
Data::TreeDumper
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 DHTML 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 HTML file.
OPTIONS¶
Style¶
CSS style is dumped to $setup->{RENDERER}{STYLE} (a ref to a scalar) if it
exists. This allows you to collect all the CSS then output it at the top of
the HTML code.
my $style ;
my $body = DumpTree
(
...
RENDERER =>
{
NAME => 'DHTML',
STYLE => \$style,
},
) ;
{RENDERER}{NO_STYLE} 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 {RENDERER}{CLASS}. 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 ASCII text by default. If
{RENDERER}{NO_GLYPH} and RENDERER}{NO_STYLE} 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 CSS and set the
appropriate class through {RENDERER}{CLASS}.
Expand/Collapse¶
Setting {RENDERER}{COLLAPSED} to a true value will display the tree collapsed.
this is false by default.
$setup->{RENDERER}{COLLAPSED}++ ;
If {RENDERER}{BUTTON}{COLLAPSE_EXPAND} 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 {RENDERER}{BUTTON}{SEARCH} 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 TODO file.
EXPORT¶
None
AUTHORS¶
Khemir Nadim ibn Hamouda. <nadim@khemir.net>
Staffan Maahlen.
Copyright (c) 2003 Nadim Ibn Hamouda el Khemir and
Staffan Maahlen. 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 <nadim@khemir.net>.
SEE ALSO¶
Data::TreeDumper.