We use TinyMCE in our own home-rolled CMS, and except for the tricky implementation of images and the ugly HTML editing screen, we like it. It's pretty solid. And as far was we are concerned, integrating it with Perl is no big deal. It's basically just working with a large textarea. So, you need to use Perl, or any language, to tap the DB for the content to edit, display it, and then save it back.
Not that you have to, but we just happen to use CGI::Application for our framework, store all our data in MySQL tables, and use HTML::Template for display. And then typical BREAD-like Perl code to handle all the in-between.
PERL:
sub edit {
my $self = shift;
my $template = $self->load_tmpl( 'edit.tmpl',
die_on_bad_params => 0);
my $dbh = $self->dbconnect(server =>'master',db => 'admin');
my $stmt = qq/SELECT content, DATE_FORMAT(lastupdated, '%b %e, %Y a
+t %r')
AS date FROM content/;
my $content = $dbh->selectrow_hashref($stmt, undef);
$template -> param( content => $content->{'content'},
date => $content->{'date'});
return $template->output;
}
HTML:
<form class="form" action="/" method="post">
<input type="hidden" name="rm" value="u" />
<script language="javascript" type="text/javascript" src="tiny_m
+ce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "exact",
elements : "content",
content_css : "mysite.css",
width : "620",
height : "600",
extended_valid_elements : "a[href|target|name]",
plugins : "table",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons3_add_before : "tablecontrols,separator
+",
theme_advanced_styles : "Header 1=header1;Header 2=header2;He
+ader 3=header3;Table Row=tableRow1", // Theme specific setting CSS cl
+asses
debug : false
});
</script>
<textarea id="content" name="content" cols="40" rows="40"><tmpl_var
+ content></textarea>
<input type="submit" value="Update Schedule" />
<input type="button" value="Cancel" onclick="window.location='/'" /
+>
(Last updated: <tmpl_var date>)</p>
</form>
UPDATE: Fixed misleading grammar.
—Brad "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
|