Installation of the CKEditor

From phpCMS

Jump to: navigation, search

The CKEditor replaces the FCKEditor and is completely based on javascript. Therefore, in principal there is no major adaption of the phpcms-system necessary.


[edit] Installation

1. Download the CKEditor at [1] and unpack it into /parser/ckeditor.

2. Replace the file /parser/include/class.edit_wysiwyg_phpcms.php by the following code (make a backup before):

<?php
/* Use the CKEditor as WYSIWYG Editor */
print <<<ENDE
<script type="text/javascript" src="{$DEFAULTS->SCRIPT_PATH}/ckeditor/ckeditor.js"></script>
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>.
In a browser with no JavaScript support, like yours,
you should still see the contents (HTML data) and you 
should be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<p>
<textarea class="ckeditor" cols="80" id="CONTENT" name="CONTENT" rows="20">
$buffer
</textarea>
</p>
ENDE;
?>

3. Enable the WYSIWG-Editor in /templates/home.tpl of your site directory, it should look like the following code.

{TEMPLATE FILE="header.tpl"}
<!-- PHPCMS CONTENT START -->
<h1>{TITEL EDITTYPE="TEXT" SIZE="90"}</h1>
{SCRIPT} <!-- This is for executing any external skripts -->
{CONTENT EDITTYPE="WYSIWYG"}
{SCRIPTFLOOR} <!-- This is for executing any external skripts -->
<!-- PHPCMS CONTENT STOP -->
{TEMPLATE FILE="footer.tpl"}
<h1>{TITEL EDITTYPE="TEXT" SIZE="90"}</h1>
{SCRIPT} <!-- This is for executing any external skripts -->
{CONTENT EDITTYPE="WYSIWYG"}
{SCRIPTFLOOR} <!-- This is for executing any external skripts -->
<!-- PHPCMS CONTENT STOP -->
{TEMPLATE FILE="footer.tpl"}

[edit] Upload of files in CKEditor

Download the CKFinder from http://ckfinder.com and unzip it to the php directory of your server, e.g. to /parser/ckfinder.

Replace the file /parser/include/class.edit_wysiwyg_phpcms.php by the following code (make a backup before):

<?php
print <<<ENDE
<script type="text/javascript" src="{$DEFAULTS->SCRIPT_PATH}/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="{$DEFAULTS->SCRIPT_PATH}/ckfinder/ckfinder.js"></script>
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript support,
like yours, you should still see the contents (HTML data) and you should be able to edit it
normally, without a rich editor interface.
</p>
</noscript>
</div>
<p>
<textarea class="ckeditor" cols="80" id="CONTENT" name="CONTENT" rows="20">
$buffer
</textarea>
<script type="text/javascript">
var editor = CKEDITOR.replace( 'CONTENT' );
CKFinder.SetupCKEditor( editor, '/parser/ckfinder/' ) ;
</script>
</p>
ENDE;
?>
Personal tools