GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
DHTML(3) User Contributed Perl Documentation DHTML(3)

Data::TreeDumper::Renderer::DHTML - DHTML renderer for Data::TreeDumper

  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

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.

Check dhtml_test.pl for a complete example of two structure dumps within the same HTML file.

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,
                        },
                ) ;

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',
                        },
                ) ;

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}.

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}
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.

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

Check the TODO file.

None

Khemir Nadim ibn Hamouda. <nadim@khemir.net>

Staffan Maahlén.

  Copyright (c) 2003 Nadim Ibn Hamouda el Khemir and 
  Staffan Maahlé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 <nadim@khemir.net>.

Data::TreeDumper.

Hey! The above document had some coding errors, which are explained below:
Around line 669:
Non-ASCII character seen before =encoding in 'Maahlén.'. Assuming CP1252
2008-12-19 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.