Archived CMSimple Support Forum

The Old CMSimple User Community
It is currently Fri Sep 10, 2010 12:34 pm

This archived CMSimple Support Forum will be locked primo June 2008. Users with a commercial licence are advised to register and use the new Official Support Forum at CMSimple.com instead. A community driven forum with free registration is found at cmsimpleforum.com.

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Got simple editor working with CMSimple
PostPosted: Sat Jun 05, 2004 9:34 am 
Offline

Joined: Fri Dec 05, 2003 9:28 am
Posts: 46
Alex King, one of the contributors to Wordpress, has released his quicktags javascript editing script -- see http://www.alexking.org/blog/2004/06/03 ... nder-lgpl/.

These might be nice for people like me, who don't need a WYSIWYG HTML editor, but like to have little buttons for things like blockquote. Right now I am using the basic simple editor for CMsimple, because Firefox crashed so regularly in the standard editor, but I would love these.

Supposedly it is just a matter of including the Javascript at the head of the editing document, and giving the text area a special name.

thanks,
Tim


Last edited by tbishop61 on Mon Jun 07, 2004 7:07 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 5:52 am 
Offline

Joined: Fri Dec 05, 2003 9:28 am
Posts: 46
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 12:55 pm 
Offline
Site Admin

Joined: Mon May 12, 2003 12:36 pm
Posts: 3091
Location: Rutsker, Bornholm, Denmark
Quote:
P.S. This is fun -- I hope it is ok with you, Peter.


Cool!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group