tags:

views:

21

answers:

1

I am using the fullpage plugin:

I am trying to create a way for my users to select multiple layouts(I have about 6 layouts), in the layouts I have different CSS rules that I would like to for example the background color

so in my layout (and this is just an example for brevity) I have

<style>
body{background-color:red}
</style>
and then my layout.....

<style>
body{background-color:green}
</style>
and then my layout.....

You get the idea ;), (I would like to use stylesheets but this did not seem to work either).

If I go into the editor and select the layout it looks great, until I hit save. It is removed from the editors returned value (I am saving to a DB).

I have tried multiple things:

If in the layout I do this:

<style><!--Start Style-->
body{background-color:red}
<!--End Style--></style>

and then my layout.....

when the user selects the layout the background color is not displayed but this is:

body{background-color:red} body{background-color:red}

but when I save it saves correctly???.

I have this as my setup

valid_elements : "*[*]",  
extended_valid_elements: "style[type]",

I have tried multiple ways, looking for quite a while through tinyMCE's documentation and Googling and no luck.

Can anyone solve or suggest a better approach(The idea is to only have them select one layout which will do everything background color and layout)?

Thanks in Advance!

A: 

You should create your own css file for your content (configuration seting content_css) and add the desired class(es) to the formats configuration parameter. If you use the style plugin users are able to select the class from the style-drop-down and everything should be fine.

Thariama
hmm, but it is possible to define the background color in the layout too
Thariama
oops deleted my last comment sorry.Understood, but that will not allow a one click solution, I will have everything predefined in the layout, so the user does not have to select the style but just the layout - imagine that the layout in the list is called "Layout 1 Red" or Layout 1 "Green" each would have different font colors backgrounds and such predefined.
TheCodeFool
Thanks for the help!How would I define it?You have to select the element to apply a background to and I cant select the body tag :)
TheCodeFool
right, you may choose span,p or the body tag
Thariama
Thanks again, do you have an example or can you point me to one, not trying to be thick I am just not getting you.
TheCodeFool
Well, that is right. To make that work it is a little bit more complicated, cause you would need to write your own Style plugin and set the body css class in your plugin code
Thariama
ok cool, so I am not crazy! So the answer is not with out of the box, and I will have to write my own. Thanks for all of your help Thariama!
TheCodeFool
if you write your own plugin you need to call something like the following after choosing an option: editor.getBody().setAttribute('class','class_choosen');
Thariama
sweet thanks again, you don't have this already do you? if you do could you post some code :)
TheCodeFool
well, i have something like that (but it will do probably more than you would like it to (forbid nested spans, own stiling rules and settings, adding user added styles in the dropdown on code change,...)). leave me your emailadresss and i will send it to you (it is far too long to be posted here)
Thariama
TheCodeFool