Tag Archives: spaw

CodeIgniter & SPAW Editor Tabs

A few months ago, I updated a great SPAW editor plug-in for CodeIgniter to use the most recent version of SPAW at the time, that included Safari Browser fixes and some CSS tweeks.

Well over the weekend I look at getting multiple tabs working.
It was pretty easy, with a couple of modifications to the SPAW wrapper class, I have create some sample usage, and examples for you to download.
I have made the CSS fixes from my previous post, and included some sample usage.

SPAW and CodeIgniter

SPAW and CodeIgniter

I am only going to explain how to create the SPAW instance within CodeIgniter, If you are unfamiliar with CI, you should first follow the Online Code Igniter Tutorial Videos.

Creating the SPAW instance

In my download, you will find a ‘pages’ controller.

function index() {

	// Define our first tab
	// 'name' == field name,
	// 'caption' == button caption,
	// 'content' == editor content
	$config = array(
		'name'    => 'content',
		'caption' => 'Content',
		'content' => !empty($_POST['content'])?$_POST['content']:'

CodeIgniter & SPAW Tabs

SPAW Editor Class for CodeIgniter, Sheldon Lendrum

' ); // start our SPAW instance $this->load->library('spaw', $config); // Add our secondary tabs $this->spaw->addTab('description', 'Description', !empty($_POST['description'])?$_POST['description']:''); $this->spaw->addTab('summary', 'Summary', !empty($_POST['summary'])?$_POST['summary']:''); // load our view $this->load->view('template'); }

SPAW Class

I have modified the SPAW class with 3 functions.

function Spaw($config) {}

The Spaw function initiates the Spaw editor. you pass in an array of the default Tab.

function show() {}

This returns the SPAW instance in to your view. It will return a string, so you will need to echo this in your layout.
EG;
< ?php echo($this->spaw->show()); ?>
You must call this ONLY IF SPAW is called in your controller previous.

function addTab($name, $caption, $value) {}

This is to add additional tabs to your spaw instance.
Your default tab is defined when you create your SPAW instance, so this is how you can call additional tabs.
$name == your field/$_POST name
$caption == your button title
$value == the SPAW editor default value.

Installing SPAW & CodeIgniter

I have included a full copy of CodeIgniter 1.7.1 with SPAW 2.0.8.1,
If you want to move the SPAW plugin to your own copy of CI, move the;
'system/application/libraries/spaw2' directory and the
'system/application/libraries/spaw.php' file.

If you are on an APACHE server and using MOD REWRITE url rules, make sure you have the included .htaccess file in the spaw2/ dir.
'system/application/libraries/spaw2/.htaccess'

Download and Install

[download#9]

SPAW WYSIWYG was showing HTML characters not HTML

I noticed when installing the SPAW Editow recently that on the Design tab in SPAW, the HTML was showing as converted HTML Symbols like &lt; and &gt; rather than < and >.

After a bit of playing, i found this hidden piece of information on the SPAW FAQ’s.


You should use getHtml() method instead of show(). It returns the code which you can store into variable and use whenever you need it.

SPAW getHTML() Rather than show()

SPAW getHTML() Rather than show()