Gantry::Utils::HTML(3)

NAME
Gantry::Utils::HTML - HTML tag generators.

SYNOPSIS
  use Gantry::Utils::HTML qw( :all );

  :common
    ht_a ht_br ht_img ht_lines ht_qt ht_uqt

  :style
    ht_b ht_h ht_i ht_p ht_up ht_div ht_udiv

  :form
    ht_checkbox ht_form ht_form_js ht_input ht_radio ht_select ht_submit
    ht_uform

  :table
    ht_table ht_tr ht_td ht_utd ht_utr ht_utable

  :jscript
    ht_popup

  ht_a
    @href = ht_a( $url, $text, @extra )

  ht_b
    @bold = ht_b( @text )

  ht_br
    $br = ht_br()

  ht_checkbox
    $checkbox = ht_checkbox( $name, $value, $form_value, @params )

  ht_div
    @div = ht_div( $options, @data )

  ht_form
    $form = ht_form( $action, @extra )

  ht_form_js
    @form = ht_form_js( $action, @extra )

  ht_h
    @h = ht_h( $level, @text )

  ht_help
    @help = ht_help( $help_root, $type, $ident )

  ht_i
    @i = ht_i( @text )

  ht_img
    @img = ht_img( $url, @extra )

  ht_input
    @input = ht_input( $name, $type, $value @params )

  ht_lines
    $lines = ht_lines( @lines )

  ht_p
    $p = ht_p()

  ht_popup
    @popup = ht_popup( $url, $text, $winname, $height, $width )

  ht_qt
    $string = ht_qt( $string )

  ht_radio
    $radio = ht_radio( $name, $value, $form_value, @params )

  ht_select
    @select = ht_select( $name, $size, $value, $multiple,
                         $opts, @items )

  ht_submit
    $submit = ht_submit( $name, $value )

  ht_table
    $table = ht_table( $options )

  ht_tr
    $tr = ht_tr( $options )

  ht_td
    @td = ht_td( $options, @data )

  ht_udiv
    $udiv = ht_udiv()

  ht_uform
    $uform = ht_uform()

  ht_up
    $up = ht_up()

  ht_uqt
    $string = ht_uqt( $string )

  ht_utable
    $utable = ht_utable()

  ht_utd
    $utd = ht_utd()

  ht_utd
    $utd = ht_utd()

  ht_utr
    $utr = ht_utr()

DESCRIPTION
Implements HTML tags in a browser non-specfic way conforming to 3.2 and above HTML specifications.

@href = ht_a( $url, $text, @extra )
    This function returns a fully formed href tag. "$url" and "$text" are required. "@extra" can contain any other tags to add to the href such as "CLASS='my_href_class'" or an other options a href may take.

@bold = ht_b( @text )
    This function takes an array or a string of text and then wraps it in ""<B">" tags. It will always return an array regardless of the input.

$br = ht_br()
    This function simply returns a ""<BR">" html tag, it takes no arguements.

$checkbox = ht_checkbox( $name, $value, $form_value, @params )
    This function generates individual checkboxes. "$name" is the name of the checkbox. "$value" is the value to set for this checkbox. "$form_value is the currently selected value, for a checkbox to be checked the $value must be exactly equal to $form_value. An %in hash with a key of $name may also be used for $form_value. @params is passed directly to the end of the checkbox, this can be used for javascript or arbitrary html.

$div = ht_div( %attributes )
    This takes an optional hash of attributes for a div tag and returns a scalar containing an opening div tag.

$udiv = ht_udiv( )
    Returns an ending div tag.

$form = ht_form( $action, @extra )
    This function takes the action of the form in the first variable "$action" any other options should be passed in through "@extra". The "@extra" array should consit of a valid form tag in the form "method='post'".

@form = ht_form_js( $action, @extra )
    This function behaves exactly the same way the "ht_form" function works, save this function adds a javascript 'anti-click' routine which should keep people from submitting a form more than one for double clicking the submit button.

@h = ht_h( $level, @text )
    This function takes a "$level" which is an integer between 1 and 6 corisponding to the h1 ... h6 tag that is used, there is not checking on the value of the integer so any value of level is acceptable to the function if not as valid html. The "@text" is wrapped in the "h" tags.

@help = ht_help( $help_root, $type, $ident )
    this function takes the help root, generally '$site{help}' a type, either 'category' or 'item' and the ident of the help item. It returns and array of html containing a link that will generate a help popup.

@i = ht_i( @text )
    This function takes "@text" and wraps it in ""<I">" tags.

@img = ht_img( $url, @extra )
    This function creates an ""<IMG SRC=..">" tag. "$url" is the url to the image, "@extra" should contain any extra tags that the image tage should contain. The "@extra" array should contain values of the form "WIDTH='10'".

@input = ht_input( $name, $type, $value @params )
    This function creates html textareas, checkboxes, text and hidden elements. "$name" is the name of the element in the html as used in the form, "$type" should be the type of the input element, ( ie: textarea, checkbox, text, radio, or hidden ). "$value" is either a hash containing the text as a key, or the variable itself. "@params" contains anything else that needs to be passed to the input type such as length or the like "LENTGH='1'".

$lines = ht_lines( @lines )
    This function takes the "@lines" array and concatanates it together with newlines ""\n"" to create a single string.

$p = ht_p()
    This function takes no arguements and returns a simple "<P"> tag.

@popup = ht_popup( $url, $text, $winname, $height, $width )
    This function creates a special html "ref" call. It creates a link to a new javascript window with the properties specified. The "$url" is the URL of the new window, "$text" is the text to be displayed by the link. "$winname" is the name of the window that will be created. "$height" and "$width" are the height and the width of the window, respectively.

$string = ht_qt( $string )
    This function will escape the html special characters in "$string" and return the specially formated value of the string.

$radio = ht_radio( $name, $value, $form_value, @params )
    This function generates individual radio buttons. "$name" is the name of the radio buttion group. "$value" is the value to set for this radio button. "$form_value is the currently selected value, for a radio button to be checked the $value must be exactly equal to $form_value. An %in hash with a key of $name may also be used for $form_value. @params is passed directly to the end of the radio button, this can be used for javascript or arbitrary html.

@select = ht_select( $name, $size, $value, $multiple, $opts, @items )
    This function creates a html select box. "$name" is the name of select box for use in parsing the form. "$size" is the number of rows to show for the select box. "$value" is the a hash reference which contains the value that is currently selected with a hash key of the value of "$name". "$multiple" needs only to be defined to create the select box as a multiple select rather than a single select box. "@items" is an array/hash of the values of the select box. $opts will be included directly into the opening of the select, this allows tweaky javascript things.

$submit = ht_submit( $name, $value )
    This function creates a submit button with the name of "$name" and the value of "$value".

$table = ht_table( $options )
    This function creates an open table tag. It takes a hash reference, $options. The hash reference should contain key value pairs corresponding to the table options ie: 'cellpadding', '0', 'border', '1' or the like.

$tr = ht_tr( $options )
    This function creates an open table row tag, it operates exactly as the "ht_table()" function does.

@td = ht_td( $options, @data )
    This function creates a table data completely from the open td tag to the close td flag. The options flag works like "ht_table()" and "ht_tr". The @data is what should appear in the table data element. To specify no wrap set 'nowrap' => '0' or any value since the function will ignore the value completely. The @data is optional, if it is not provided then the td will just issue an opening <td> and the ht_utd function should be used as well.

$uform = ht_uform()
    This function should be paried with either "ht_form" or "ht_form_js" to close a HTML form.

$up = ht_up()
    This function returns a ""</P">" tag, for use in conjunction with ""ht_p"".

$string = ht_uqt( $string )
    This function reverses the affects of the "ht_qt" function, retuning the original sting if passed an encoded string.

$utable = ht_utable()
    This function closes a HTML table. It don't take anything but it sure give a ""</TABLE">".

$utr = ht_utd()
    This function closes a table data. It takes no options.

$utr = ht_utr()
    This function closes a table row. It takes no options.

SEE ALSO
Gantry(3)

LIMITATIONS
Watch out for the context of what the variables return, sometimes it is an array sometimes it is a string.

AUTHOR
Nicholas Studt <nstudt@angrydwarf.org>

COPYRIGHT and LICENSE
Copyright (c) 2003-6, Nicholas Studt.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.