HTML::TagHelper - Generate HTML tags in an easy way


HTML-TagHelper documentation  | view source Contained in the HTML-TagHelper distribution.

Index


NAME

Top

HTML::TagHelper - Generate HTML tags in an easy way

VERSION

Top

Version 0.01

SYNOPSIS

Top

    use HTML::TagHelper;

    my $th = HTML::TagHelper->new();
		print $th->image_tag(...);
		print $th->link_to(...);
		my $th->text_field_tag(...);
		my $th->select_tag(...);
		my $th->options_for_select(...);




DESCRIPTION

Top

The module contains some code generators to easily create tags for links, images, select-tags etc.

This is mostly a port of the Ruby on Rails helper tags for use in Catalyst.

FUNCTIONS

Top

image_tag

$th->image_tag($src, \%options)

Create an img html element pointing to $src.

Required options are:

src: Specifies the link to the image to be displayed.

Addtional options are:

alt: An alt text for the tag. B default this is the filename of src without extension.

escape_html: Whether or not you want to escape the outputted html (default is 1).

Besides this options, you can enter any option you want as an attribute on the tag, e.g. class, id etc.

text_field_tag

$th->text_field_tag($name, \%options)

Create a text input html element.

Required options are:

name: The content of the name attribute on the tag

Addtional options are:

id: The content of the id attribute on the tag (defaults to the value of name).

value: The value of the tag

Besides this options, you can enter any option you want as an attribute on the tag, e.g. class, id etc.

select_tag

$th->select_tag($name, \@options, \%html_options)

Create a select html element.

Required options are:

name: The content of the name attribute on the tag

The options array must contain either the output of options_for_select or an array of hashes with title and value as keys.

Addtional html_options are:

id: The content of the id attribute on the tag (defaults to the value of name).

Besides this html_option, you can enter any option you want as an attribute on the tag, e.g. class, id etc.

options_for_select

$th->options_for_select(\@options)

Create all options html elements to put inside select_tag.

Required options are:

options: This is an array of hashes, where the title pair will be used for content of the tag, and the value pair will be used for value.

Example:

    $th->options_for_select( [{title => "Option 1", value="option1"}, {title => "Option 2", value => "option2"}] );

date_select_tag

$th->date_select_tag($name, \%options)

Create 3 select html element - one for day, one for month and one for year.

Required options are:

name: The content of the name attribute on the tag. They are all post-fixed with "day", "month" or "year"

The options array must contain either the output of options_for_select or an array of hashes with title and value as keys.

Addtional options are:

year_start: Which year should be the first option. Defaults to DateTime->now->year

year_end: Which your should be the last option. Default to start_year + 5

id: The content of the id attribute on the tag (defaults to the value of name).

class: The content of the class attributes on the tags.

Besides this html_option, you can enter any option you want as an attribute on the tag, e.g. class, id etc.

AUTHOR

Top

Gitte Wange Olrik, <gitte at olrik.dk>

BUGS

Top

Please report any bugs or feature requests to bug-html-taghelper at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-TagHelper. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc HTML::TagHelper




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-TagHelper

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/HTML-TagHelper

* CPAN Ratings

http://cpanratings.perl.org/d/HTML-TagHelper

* Search CPAN

http://search.cpan.org/dist/HTML-TagHelper

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


HTML-TagHelper documentation  | view source Contained in the HTML-TagHelper distribution.