Custom wysiwyg for some viewers

8 posts by 2 authors in: Forums > CMS Builder
Last Post: August 10, 2011   (RSS)

By avrom - August 6, 2011

Hey guys,

I'm sure somebody has already asked this. I woud like to have a wysiwyg editor that only shows the "spell check" button in the toolbar, for some viewers, but still keep the default wysiwyg fro everything else. Doable?

Cheers
Avrom

Re: [Jason] Custom wysiwyg for some viewers

By avrom - August 8, 2011

Jason, that's perfect. While it would be only the spellcheck field I would show, your example is crystal clear. Thanx a lot man!

Cheers
Avrom

Re: [Jason] Custom wysiwyg for some viewers

By avrom - August 9, 2011

Hi Jason,

Your example works jsut fine. I'd also like to add another line with a "null" statement, since the editor has 2 lines of editor options showing, and I only need one line to display. But not sure the php syntax for that. I know its pretty simple. Thanks in advance :)

theme_advanced_buttons1 : '',

would become?

$theme_advanced_buttons1 = \"CODE\",";

Cheers
Avrom

Re: [avrom] Custom wysiwyg for some viewers

By Jason - August 10, 2011

Hi Avrom,

Do you mean that on certain sections you want to have theme_advanced_buttons1 display and on others you don't?

Let me know.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Custom wysiwyg for some viewers

By avrom - August 10, 2011

Jason, exactly. Just not sure how to call up the two single quotes in PHP to make that happen :)

Cheers and thanx
Avrom

Re: [avrom] Custom wysiwyg for some viewers

By Jason - August 10, 2011

Hi Avrom,

Okay. I'm not sure when you want to display the buttons and when you don't, but this example should get you started.

In this example, we'll assume that if we are in a section where we are displaying the spell checker, we're also displaying the first advanced buttons line. In that case, we would change our if statement to look like this:

$spellCheckerSections = array('articles', 'news');
$theme_advanced_buttons1 = "theme_advanced_buttons2: '',";
$theme_advanced_buttons2 = "theme_advanced_buttons2 : \"forecolor,backcolor,|,link,unlink,anchor,|,blockquote,hr,image,media,table,|,pastetext,pasteword,|,code,|,spellchecker\",";

if (!in_array(@$_REQUEST['menu'], $spellCheckerSections)) {
$theme_advanced_buttons2 = "theme_advanced_buttons2 : \"forecolor,backcolor,|,link,unlink,anchor,|,blockquote,hr,image,media,table,|,pastetext,pasteword,|,code,|\",";
$theme_advanced_buttons1 = "theme_advanced_buttons1 : \"formatselect,fontsizeselect,bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,outdent,indent,|,removeformat,fullscreen\", ";
}


Then we change where we output these values like this:

// Define buttons: Button codes: http://wiki.moxiecode.com/index.php/TinyMCE:Control_reference
{$theme_advanced_buttons2}
{$theme_advanced_buttons2}
theme_advanced_buttons3 : '',


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Custom wysiwyg for some viewers

By avrom - August 10, 2011

Jason, that's perfect! Thanx for your time and help :)