I got the quicktags editor working with CMSimple today. I downloaded the file from the link above and copied js_quicktags.js into the same directory that my index.php is in.
Then I took the code that Peter Harteg provided a while ago for a simple editor (see
http://www.cmsimple.dk/forum/viewtopic.php?t=365) and changed it to:
Code:
// Took original from CMSimple forum http://www.cmsimple.dk/forum/viewtopic.php?t=365
// for making a very simple plain text editor that should work with any browser and
// changed it to work with Alex King's javascript-based quicktags (see
// http://www.alexking.org/blog/2004/06/03/js-quicktags-under-lgpl/
if ($edit && (!$f || $f == 'save') && !$download) {
if ($s < 0 && $ss < count($c))$s = $ss;
if ($s > -1) {
$su = $u[$s];
$o .= '<form method="post" style="margin:0" id="ta" action="' . $sn . '">
<script type="text/javascript">edToolbar();</script>
<input type="hidden" name="selected" value="' . $u[$s] . '">
<input type="hidden" name="function" value="save">
<textarea name="text" id="canvas" ROWS="15" COLS="40">' . $c[$s] . '</textarea>
<script type="text/javascript">var edCanvas = document.getElementById' . "('canvas')" . ';</script>
<input type="submit"></form>';
} else $o = '<p>' . $tx['error']['cntlocateheading'] . '</p>';
}
Of course commenting out all the stuff below under //EDITOR CALL.
I also had to change the head function to include the javascript, as so:
Code:
// PAGE FUNCTIONS
// tb added 2 lines for quicktags
function head() {
global $title, $cf, $pth, $tx, $hjs;
if ($cf['site']['title'] != '')$t = $cf['site']['title'] . ' - ' . $title;
else $t = $title;
$t = '<title>' . $t . '</title>';
$quicktags = '<script src="js_quicktags.js" type="text/javascript"></script>';
foreach($cf['meta'] as $i => $k)$t .= meta($i);
if ($tx['meta']['codepage'] != '')$t .= '<meta http-equiv="content-type" CONTENT="text/html;charset=' . $tx['meta']['codepage'] . '">';
return $t . $quicktags . '<meta NAME="generator" CONTENT="CMSimple 2.3 - www.cmsimple.dk"><link rel="stylesheet" href="' . $pth['file']['stylesheet'] . '" type="text/css" />' . $hjs;
}
It seems to work, after about an hour's testing.
If anyone else tries this, let me know how if it works. I personally much prefer this kind of simple editor.
Thanks,
Tim
P.S. This is fun -- I hope it is ok with you, Peter. And thank you Alex for the nice little editor.