HTML::ForumCode::Cookbook::Recipe2 - HTML, JavaScript and CSS
<script type="text/javascript" src="[%c.uri_for('/static/script/MessagePreview.js')%]"></script>
.message-preview-overlay { border: 1px dashed #ccc; text-align: left; padding: 0px; }
<textarea name="text_stuff" id="text_stuff_entry" cols="45" rows="5"></textarea> <input type="button" id="text_preview_button" value="Preview Message" accesskey="P" name="post_reply" class="input_button" /> <!-- message preview majick --> <script type="text/javascript"> var MessagePreview = new ForumMessagePreview(); MessagePreview.config.label_preview = 'Preview Message'; MessagePreview.config.label_edit = 'Edit Message'; MessagePreview.config.icon_preview = '/static/images/icons/layout_content.png'; MessagePreview.config.icon_edit = '/static/images/icons/layout_edit.png'; MessagePreview.config.post_url = "[%c.uri_for('/forumcode/preview')%]", MessagePreview.config.trigger = 'text_preview_button'; MessagePreview.config.user_input = 'text_stuff_entry'; MessagePreview.init(); </script> <!-- (end) message preview majick -->
<textarea name="some_text" id="some_text_entry" cols="45" rows="5"></textarea> <img id="text_preview_icon" src="[%c.uri_for('/static/images/icons/layout_content.png')%]" alt="Preview Message" title="Preview Message" width="16" height="16" /> <!-- message preview majick --> <script type="text/javascript"> var MessagePreview = new ForumMessagePreview(); MessagePreview.config.label_preview = 'Preview Message'; MessagePreview.config.label_edit = 'Edit Message'; MessagePreview.config.icon_preview = '/static/images/icons/layout_content.png'; MessagePreview.config.icon_edit = '/static/images/icons/layout_edit.png'; MessagePreview.config.post_url = "[%c.uri_for('/forumcode/preview')%]", MessagePreview.config.trigger = 'text_preview_icon'; MessagePreview.config.user_input = 'some_text_entry'; MessagePreview.init(); </script> <!-- (end) message preview majick -->
This recipe provides the HTML, JavaScript and CSS markup required to implement a message preview text area on a page.
MessagePreview.js will be required to perform the preview actions. This script requires YUI.
Until a more sensible solution can be arrived at MessagePreview.js can be found in the examples directory of this distribution.
Chisel Wright <chiselwright@users.berlios.de>
<chiselwright@users.berlios.de>
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Template::Plugin::ForumCode, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::ForumCode
CPAN shell
perl -MCPAN -e shell install Template::Plugin::ForumCode
For more information on module installation, please visit the detailed CPAN module installation guide.