|  | HTML |  |

|  | Splash! |  |

|  | PostScript |  |

| Template Toolkit Examples: HTML Library: Links and Buttons |

|  | index |  |

|  | rgb |  |

|  | headers |  |

|  | lists |  |

|  | links |  |

|  | tables |  |

|  | bars |  |

|  | menus |  |

# Links and Buttons

These elements can be used to create basic links and buttons which contain links.

Source #1:

    [% PROCESS html/link
        link = 'http://www.tt2.org/'
    %]

HTML Output #1:

    <a href="http://www.tt2.org/">http://www.tt2.org/</a>

Output #1:

http://www.tt2.org/

Source #2:

    [% PROCESS html/link
        link = 'http://www.tt2.org/'
        text = 'Template Toolkit Web Site'
    %]

HTML Output #2:

    <a href="http://www.tt2.org/">Template Toolkit Web Site</a>

Output #2:

Template Toolkit Web Site

Source #3:

    [% section = {
           headers => 'Headers and Footers'
           links   => 'Links and Buttons'
           tables  => 'Tables, Rows and Cells'
           bars    => 'Bars, Boxes and Edges'
       }
       order = [ 'headers', 'links',
                 'tables',  'bars' ]
    %]

    <ul>
    [% FOREACH item = order -%]
      <li>[% PROCESS html/link
             link = "${item}.html"
             text = section.$item  %]
    [% END %]
    </ul>

HTML Output #3:

    <ul>
      <li><a href="headers.html">Headers and Footers</a>
      <li><a href="links.html">Links and Buttons</a>
      <li><a href="tables.html">Tables, Rows and Cells</a>
      <li><a href="bars.html">Bars, Boxes and Edges</a>
    </ul>

Output #3:

- Headers and Footers
- Links and Buttons
- Tables, Rows and Cells
- Bars, Boxes and Edges

Source #4:

    [% INCLUDE html/button
         text = "Hello World"
    %]

HTML Output #4:

    [&nbsp;Hello&nbsp;World&nbsp;]

Output #4:

[ Hello World ]

Source #5:

    [% INCLUDE html/button
        text = "Index Page"
        link = "index.html"
    %]

HTML Output #5:

    [&nbsp;<a href="index.html">Index&nbsp;Page</a>&nbsp;]

Output #5:

[ Index Page ]

Source #6:

    [% INCLUDE html/button
        text   = "Selected Item"
        select = 1
    %]

HTML Output #6:

    [<b>&nbsp;Selected&nbsp;Item&nbsp;</b>]

Output #6:

[ Selected Item ]

Source #7:

    [% INCLUDE html/button
        text  = "Prev Item"
        link  = "headers.html"
        left = 1
    %]

    [% INCLUDE html/button
        text  = "Next Item"
        link  = "menus.html"
        right = 1
    %]

HTML Output #7:

    &lt;-[&nbsp;<a href="headers.html">Prev&nbsp;Item</a>&nbsp;]
    [&nbsp;<a href="menus.html">Next&nbsp;Item</a>&nbsp;]-&gt;

Output #7:

<-[ Prev Item ] [ Next Item ]->