Template::Plugin::Tooltip - Template Toolkit plugin for HTML::Tooltip::JavaScript
Load the tooltip generator. Params are passed straight to to HTML::Tooltip::JavaScript->new [% USE tooltip( ... ) %] Add a tooltip to a link <a href="foo" [% tooltip( html_tooltip_content, param => value, param => value, %]>Link content</a>
Template::Plugin::Tooltip is a Template Toolkit hook to the marvelous HTML::Tooltip::Javascript module.
The first version was written in 30 minutes following the talk on HTML::Tooltip::Javascript at the Open Source Developers Conference, just after its initial release.
This module is very much just a thin layer over the top of the HTML::Tooltip::JavaScript API, and you should probably go read and understand its API before using this module.
To summarise VERY briefly, when you load in the plugin, the params go as params to the H::T::Javascript new constructor, with the new Tooltip object stored internally. When you create a tooltip, the HTML content and parameters are passed directly to H::T::Javascript tooltip method.
new
tooltip
To load the tooltip generator with the default options, you can simple do the following.
[% USE tooltip %]
In the same way you pass params to the HTML::Tooltip::Javascript constructor, you can also pass params when loading in the Tooltip plugin.
[% USE tooltip('param' => 'value') %]
HTML::Tooltip::Javascript provides one simple method through which you generate all the different tooltips.
In Template::Plugin::Tooltip, you just use the loaded plugin directly.
[% tooltip( 'This is my plain tooltip' ) %]
This only generates the Javascript tag properties, so this needs to be used within a tag, like an anchor tag.
<a href="#item" [% tooltip('A tooltip') %]>item</a>
The first param is literal HTML content, and you can provide any additional parameters you want for the tooltip, as you would do create the tooltip directly.
<a href="#item" [% tooltip('A tooltip', 'bgcolor' => 'pink') %]>item</a>
The one additional step you will need to do is load in the tooltip JavaScript library that drives the whole thing.
To do this, simple add the following to the end of the page, or to the E<LT>headE<GT> section of your HTML document.
[% tooltip() %]
TO BE COMPLETED
Bugs should be submitted via the CPAN bug tracker, located at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Template%3A%3APlugin%3A%3ATooltip
For other issues, contact the author.
Adam Kennedy (Maintainer), http://ali.as/, cpan@ali.as
Thank you to Phase N Australia (http://phase-n.com/) for permitting the open sourcing and release of this distribution as a spin-off from a commercial project.
Copyright (c) 2004 Adam Kennedy. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
1 POD Error
The following errors were encountered while parsing the POD:
Unknown E content in E<LT>
Unknown E content in E<GT>
To install Template::Plugin::Tooltip, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::Tooltip
CPAN shell
perl -MCPAN -e shell install Template::Plugin::Tooltip
For more information on module installation, please visit the detailed CPAN module installation guide.