Script adapting: SPAW

From phpCMS

Jump to: navigation, search

These instructions are now updated to work with phpCMS v1.2.2 and Spaw v2.0

phpCMS is prepared to plug in most available WYSIWYG editors. It is only necessary to add a very small php script to the phpCMS include directory to make the connection between Spaw and phpCMS.

This little how-to explains, how to integrate the spaw2 online editor with phpCMS. If no problems occur, this task should be completed in about 15 minutes.

In version 2.0 Solmentra has hugely improved the spaw editor, so it can now be recommended without any doubts. The spaw editor now works with most brosers (IE, Mozilla, Firefox, Opera, ..), offers a huge number of features and produces valid XHTML output.

1. download spaw 2.0 from http://www.solmetra.com

2. uncompress the downloaded spaw archive and upload the directory "spaw2" into the phpCMS-directory on the server (normally this will be "/parser").

3. change to the directory parser/spaw2/config and rename the file config.default.php to config.php

4. open http://yourdomain.com/parser/spaw2/demo/demo.php in your webbrowser for a first quick test of spaw2.

  • If the editor doesn't run, you might need to adjust some pathes or settings in your spaw2/config/config.php file. Please refer to the spaw2 documentation in case of any troubles at this stage.
  • If the editor runs, but you see a phpCMS "Error 09" errormessage inside spaw's edit area, you have to create a new file called .htaccess in the spaw2 directory with the following one line of content:
AddType text/html  .html
  • After you have created this file and reloaded the demo, the phpCMS error message should disappear (you might need to hold the shift key down while clicking on the reload button of your webbrowser, otherwise it might simply reload the old version from it's cache!).
    The reason for this is, that spaw2 loads files with the file extension .html, which should not be parsed by phpCMS to iframes. With this .htaccess file you prevent the apache webserver from passing all .html files in the spaw2 directory to the phpCMS parser (they are handled again as "usual" html files).
    If you use a different webserver than apache or a different method to pass content files to the phpCMS parser, you might have to adjust the .htaccess file to your method or use a different way.
  • If you can run the spaw2 demo and don't get a phpCMS error message inside the edit area, you can proceed with the phpCMS integration.

5. Save the following short php-Script on the server under the filename /parser/include/class.edit_wysiwyg_phpcms.php.

<?php
	if (!defined('SPAW_ROOT'))
	{
		define('SPAW_ROOT', $DEFAULTS->DOCUMENT_ROOT.$DEFAULTS->SCRIPT_PATH.'/spaw2');
		include_once(SPAW_ROOT.'/spaw.inc.php');
	}
	$spaw_instance = 'spaw_'.$FIELD;
	${$spaw_instance} = new SpawEditor($FIELD, $buffer);
	${$spaw_instance}->show();
?>

That's all folks!

You can now use the edittype "WYSIWYG" in your templates, which makes the fields editable with the spaw2 editor:

{CONTENT EDITTYPE="WYSIWYG"}

Main Page: Main Page | Top Page: Tutorials MainPage

Personal tools