Professional CodeIgniter, Thomas Myer
Chapter 8: Last-Minute Upgrades
259
Integrating the TinyMCE Editor
If you ' ve been paying attention, you ' ll notice that the text area isn ' t WYSIWYG. That ' s because you
haven ' t added the necessary code to make that happen! Remember what you did before, in the pages
area? You added a small bit of code to the controller ' s constructor, then echoed the appropriate piece on
the view.
Therefore, in your Subscribers controller, add this bit to the constructor function:
function Subscribers(){
parent::Controller();
if ($this-
>
session-
>
userdata(`userid')
<
1){
redirect(`welcome/verify','refresh');
}
$this-
>
tinyMce = `
<
!-- TinyMCE --
>
<
script type="text/javascript" src="'. base_url()
.'js/tiny_mce/tiny_mce.js"
>
<
/script
>
<
script type="text/javascript"
>
tinyMCE.init({
// General options
mode : "textareas",
theme : "simple"
});
<
/script
>
<
!-- /TinyMCE --
>
';
}
Next, add the following line to the top of the admin_subs_email view:
echo $this-
>
tinyMce;
The result should look something like Figure 8 - 9 .
c08.indd 259
c08.indd 259
6/10/08 5:37:33 PM
6/10/08 5:37:33 PM