Page 1 of 1

formatting content with <div>

Posted: Wed Mar 17, 2010 9:52 pm
by thomahawk
Hello
I am sure this topic must have been discussed, but I can not find any topic on this:

I see users can edit page content with TinyMCE and give elements a class style and a format like or or . Usually it can make a tag around an element or a , but I never got it to make a tag for an element (without using html-editing of course as my CMS websites are usually developed to be used by "odinary" people ;-) ). Is this possible somehow?

Using style and format combined to get to a tag is still complicated for most users though. It would be preferrable to just have one list of formats like in the style menu and choosing from this list just puts an element inside a tag.

Any idea?

Thom

Re: formatting content with <div>

Posted: Thu Mar 18, 2010 5:07 pm
by scooper
Ah - now it can be done but there is a bit of a drawback...

To do it, it you go to Extensions->TinyMCE WYSIWYG and click on the Advanced tab.
Then in the Extra configuration: textarea add a style_format option.
For example:

Code: Select all

	style_formats : [{ title : 'Grey Box', block : 'div', classes : 'greyBox' }]
That will then give you an option in the Styles drop down called 'Grey Box' which will apply the class 'greybox' in a div to your selection. You get the idea.

The drawback is that this will have removed all of your normal styles pulled automatically from your stylesheet. This may not be a bad thing (don't give users too many options) but means that if you want to give them more then you'll have to add them as above rather than just adding them to your stylesheets.

At least that's the way I've always done it - if anyone knows a better way.....

s.

Re: formatting content with <div>

Posted: Mon Mar 22, 2010 7:19 am
by thomahawk
Thank you Scooper for that input. I will certainly try that. I have used the style option before so I know that this removes all other styles from the menu and I agree, it is good for the users to give them only the necessary styles here.

Thom