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

In reply to Re: tinymce and perl by bradcathey
in thread tinymce and perl by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.