The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::TagHelpers - Tag Helpers Plugin

SYNOPSIS

    # Mojolicious
    $self->plugin('tag_helpers');

    # Mojolicious::Lite
    plugin 'tag_helpers';

DESCRIPTION

Mojolicous::Plugin::TagHelpers is a collection of HTML5 tag helpers for Mojolicious. Note that this module is EXPERIMENTAL and might change without warning!

Helpers

form_for
    <%= form_for login => (method => 'post') => {%>
        <%= input 'first_name' %>
    <%}%>
    <%= form_for login => {foo => 'bar'} => (method => 'post') => {%>
        <%= input 'first_name' %>
    <%}%>
    <%= form_for '/login' => (method => 'post') => {%>
        <%= input 'first_name' %>
    <%}%>
    <%= form_for 'http://mojolicious.org/login' => (method => 'post') => {%>
        <%= input 'first_name' %>
    <%}%>

Generate form for route, path or URL.

img
    <%= img '/foo.jpg' %>
    <%= img '/foo.jpg', alt => 'Image' %>

Generate image tag.

input
    <%= input 'first_name' %>
    <%= input 'first_name', value => 'Default name' %>

Generate form input element.

label
    <%= label first_name => {%>First name<%}%>

Generate form label.

    <%= link_to index => {%>Home<%}%>
    <%= link_to index => {foo => 'bar'} => (class => 'links') => {%>Home<%}%>
    <%= link_to '/path/to/file' => {%>File<%}%>
    <%= link_to 'http://mojolicious.org' => {%>Mojolicious<%}%>

Generate link to route, path or URL.

script
    <%= script '/script.js' %>
    <%= script {%>
        var a = 'b';
    <%}%>

Generate script tag.

tag
    <%= tag 'div' %>
    <%= tag 'div', id => 'foo' %>
    <%= tag div => {%>Content<%}%>

HTML5 tag generator.

METHODS

Mojolicious::Plugin::TagHelpers inherits all methods from Mojolicious::Plugin and implements the following new ones.

register

    $plugin->register;

Register helpers in Mojolicious application.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicious.org.