Gitte Wange Olrik > HTML-TagHelper-0.01 > HTML::TagHelper

Download:
HTML-TagHelper-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.01   Source   Latest Release: HTML-TagHelper-0.03

NAME ^

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

VERSION ^

Version 0.01

SYNOPSIS ^

    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 ^

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 ^

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.

link_to

$th->link_to($content, \%options)

Create an 'a' html element with the flexibility to make popups, post to the url instead, ask for confirmation etc.

Required options are:

content: Specifies what the visible text is to the user (the stuff between <a> and </a>).

Addtional options are:

href: Where the link should point to (default is #).

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

confirm: The text that will popup in a confirm box.

popup: Opens a new window where the source is href.

method: If you want to use 'POST' instead of 'GET'.

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 ^

Gitte Wange Olrik, <gitte at olrik.dk>

BUGS ^

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 ^

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

    perldoc HTML::TagHelper

You can also look for information at:

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

Copyright 2008 Gitte Wange Olrik, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: