I put together a plugin to make it easier to use HTML::Prototype from
within CGI::Application (specifically when using Template Toolkit).
It isn't up on CPAN yet, but I'll probably get it up there tomorrow
sometime. For those who haven't used it, HTML::Prototype is a
JavaScript code generation library that uses the popular prototype.js
library.
For now you can download or browse the release here:
http://cees.crtconsulting.ca/perl/modules/CGI-Application-Plugin-HTMLPrototype-0.10.tar.gz
http://cees.crtconsulting.ca/perl/modules/CGI-Application-Plugin-HTMLPrototype-0.10/
You should also look at using the latest release of the TT plugin
(will appear on CPAN tomorrow as well) which works very well with this
plugin (although it is not necesary):
http://cees.crtconsulting.ca/perl/modules/CGI-Application-Plugin-TT-0.07.tar.gz
http://cees.crtconsulting.ca/perl/modules/CGI-Application-Plugin-TT-0.07.tar.gz
Here is the README for CGI::Application::Plugin::HTMLPrototype
============================================
NAME
CGI::Application::Plugin::HTMLPrototype - Give easy access to the
prototype JavaScript library using HTML::Prototype
SYNOPSIS
use base qw(CGI::Application);
use CGI::Application::Plugin::HTMLPrototype;
sub myrunmode {
my $self = shift;
# Get prototype object
my $prototype = $self->prototype;
}
DESCRIPTION
HTML::Prototype is a JavaScript code generator for the prototype.js
JavaScript library (<http://prototype.conio.net/>), and the
script.aculo.us extensions to prototype.js (<http://script.aculo.us/>).
It allows you to easily add AJAX calls and dynamic elements to your
website.
METHODS
prototype
Simply returns an HTML::Prototype object. See the HTML::Prototype docs
for information on the methods that are available to you.
TEMPLATE TOOLKIT INTEGRATION
This module is very useful when used in concert with the Template
Toolkit. Since version 0.07 The CGI::Application::Plugin::TT module
automatically adds a 'c' parameter to your template, which gives you
access to your CGI::Application object from within your templates. This
will give you easy access to the prototype plugin from within all of
your templates.
Here is an example. The following example will create a hidden 'div' tag
and a link that will make the div fade in when clicked.
[% c.prototype.define_javascript_functions %]
<a href="#" onclick="[% c.prototype.visual_effect( 'Appear',
'extra_info' ) %]">Extra Info</a>
<div style="display: none" id="extra_info">Here is some more
extra info</div>
EXAMPLE
See the examples directory for some examples
AUTHOR
Cees Hek <suppressed>
BUGS
Please report any bugs or feature requests to
"suppressed", or through the
web interface at <http://rt.cpan.org>. I will be notified, and then
you'll automatically be notified of progress on your bug as I make
changes.
CONTRIBUTING
Patches, questions and feedback are welcome.
SEE ALSO
CGI::Application, CGI::Application::Plugin::TT, HTML::Prototype, perl(1)
LICENSE
Copyright (C) 2005 Cees Hek, All Rights Reserved.
This library is free software. You can modify and or distribute it under
the same terms as Perl itself.
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.