WYSIWYG different styles?

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 28, 2013   (RSS)

Hi Tim,

There isn't currently an easy way to do this. But I've found a workaround you can use. If you open /cmsAdmin/lib/wysiwyg.php around line 34 you should see two lines likes this:

  $wysiwygCssFilename    = file_exists( dirname(__FILE__) .'/wysiwyg_custom.css' ) ? 'wysiwyg_custom.css' : 'wysiwyg.css';
  $wysiwygCssModified    = filemtime( dirname(__FILE__) ."/$wysiwygCssFilename" );

If you wanted to change it so that a different css file was used for certain sections, you could do something like this:

  // load either wysiwyg_custom.css (if exists) or wysiwyg.css
  $wysiwygCssFilename    = file_exists( dirname(__FILE__) .'/wysiwyg_custom.css' ) ? 'wysiwyg_custom.css' : 'wysiwyg.css';
  if(@$_REQUEST['menu'] == 'blog'){ $wysiwygCssFilename = 'blog.css'; }
  $wysiwygCssModified    = filemtime( dirname(__FILE__) ."/$wysiwygCssFilename" );

So if a section has a WYSIWYG editor, this if statement checks if it is for the blog section, and then loads blog.css instead. 

You would have to store blog.css in the same directory that wysiwyg_custom.css is stored. 

As this is a change to a core CMS Builder file, any future upgrades would remove this functionality.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Fantastic - I'll check this out.

Thanks.

Cheers,

Tim (toledoh.com.au)

Works perfectly - and if you change wwysiwyg.php to wysiwyg_custom.php is won't get overwritten... cool!

Cheers,

Tim (toledoh.com.au)