trillbox

trillbox is a flexible and extendable toolkit for building dynamic Web pages.
Download

trillbox Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • James Robson
  • Publisher web site:
  • http://sylbi.arbingersys.com/

trillbox Tags


trillbox Description

trillbox is a flexible and extendable toolkit for building dynamic Web pages. trillbox is a flexible and extendable toolkit for building dynamic Web pages.Written in Perl and based on Template::Recall, it provides "widgets" (or controls) that you can quickly integrate into your Perl Web application. trillbox widgets are designed to be independent points of control that can be easily plugged into a Web programming system, e.g. a CGI application, template-based, or included as part of an application framework.Widgets purposely have no direct knowledge of each other in order to offer the greatest flexibility (although they may be designed so that output and input can be piped between widgets).trillbox adds easy, "pluggable" components to your web application. By way of introduction, we will step through a simple CGI application that uses the Trillbox::DataTable component to output data from a table in a MySql database. We will start simple and get progressively more complex as we go.Here is the script#!C:/zangweb/perl/bin/perl.exeuse CGI qw(:standard);use DBI;# Load our TR widgets from hereuse lib '../../';use Trillbox::DataTable;print header;print start_html;print "< h2 >Trillbox::DataTable demo< /h2 >";my $dbh = DBI->connect( "DBI:mysql:database=test;host=localhost", "root", "", {'RaiseError' => 1} );my $dt = Trillbox::DataTable->new();$dt->set( table_attrs => 'border="1"' );$dt->set( colnames => );# Connect DBI output to DataTable:$dt->set( bind_data => $dbh->selectall_arrayref("select * from trillbox_intro") );$dbh->disconnect();# Output the dataprint $dt->output(); print end_html;Notice the statementuse lib '../../'; prior to 'use Trillbox::DataTable;'. This instructs our script that we will find the trillbox components two directories above the location of the script. After this line of code, you can add any component you like simply with use Trillbox::Component;You may download and put trillbox in any location that is appropriate. The 'use lib path' statement tells your code where the components may be found. This allows you to run trillbox on servers that may not have the dependent modules installed. This is a standard CGI script, so we do the usual things like 'print header', and 'print start_html'. Using DBI, we connect to a MySql server, in this case, one running on our workstation.Then, we instantiate the Trillbox::DataTable object via it's new() method. No parameters need to be passed to new(). You set properties on the object using the set() method. In the following statement, we set the attributes of the produced by $dt so that it has a border. We use set() again, this time to set the column header names of the table. set() expects one or more name/value pairs. In this case, 'colnames' is the property name, and the anonymous array represents the column header values.set() is probably the most overworked method of the Trillbox core components. We now use it to set the 'bind_data' property of $dt to the output from the DBI object. You can see that we pass our SQL statement into the $dbh->selectall_arrayref() method, and it returns a reference to an array, which is exactly what 'bind_data' expects. Any array in your code can be "bound" to DataTable by passing a reference to it. (Note that it expects a 2-dimensional array, that is, an array of arrays.)What's New in This Release:· Added Treeview widget.· Build nested structures of nodes, like a file system directory tree.


trillbox Related Software