-
Notifications
You must be signed in to change notification settings - Fork 0
SPAW
Category:Library::External | Category:Library::WYSIWYG [h2]Introduction[/h2] SPAW is a very powerful and easy to use visual editor that I like to use in my applications.
I wanted to keep it flowing with the rest of my CI app by using the loader class to load it (instead of including it at strange places in my views), so I turned it into a custom library which can be loaded. [h2]Dowload[/h2] File:spaw2.zip
[h2]Installation[/h2] Download the spaw2.zip file and unzip its contents into your libraries directory within your CI app.
Move the spaw.php file within the spaw2 directory into the libraries directory.
[i]Note: as of CodeIgniter_1.5.3 the loader class cannot recurse directory structures in the libraries directory, spaw.php needs to be directly inside it.[/i]
Then, inside your controller do something like this: [code]class Test extends Controller { function Test() { parent::Controller(); $config = array('name' => 'SpawTest', 'content' => 'This should be in textarea.'); $this->load->library('spaw', $config); } function index() { $this->load->view('test_view'); } }[/CODE]
Notice 'spaw' is the name of the spaw.php library file the instance of the editor is loaded from there; and $config is the parameter array for the editor.
The $config array, the 'name' key holds the value for the name of the SPAW instance, and the 'content' key holds the value for the textarea (the text that shows up by default before the user does any input).
Now, to actually load the editor into the browser window, I chose to call it in my view like so: [CODE]<html> <head> <title>Test for SPAW LIBRARY</title> </head> <body> <?=$this->spaw->show();?> </body> </html>[/CODE]
$this->spaw->show() is what does the magic.
There are many, many other configurable options (width, height, stylehseet to use, toolbar config, etc) and can be set with SPAW's default static methods. Just remember to replace [CODE]$spaw->[/CODE] with [CODE]$this->spaw[/CODE]
This integration is not exhaustive and I am releasing this under the same license the software came with. [h2]Links[/h2] [url=http://codeigniter.com/forums/viewthread/53053/]Forum thread[/url] [url=http://www.puredissertation.com/]Custom Dissertation[/url] [url=http://www.professays.com/]Custom Essay[/url] [url=http://www.hqessays.com/]Buy Essays[/url]