You are not logged in.

#1 2005-07-13 17:24:27

DontBogartMe
Member
Registered: 2005-02-09
Posts: 34
Website

More than one stylesheet for content_css

Hi,

Sorry if this has been answered b4 - I've search and only found someone else asking the same question without any answers.

My site's styles are defined per page by combining various stylesheets - therefore I need to be able to use more than one stylesheet file for my TinyMCE's editor 'content_css'.

Can this be done? From the manual it seems you can only choose one stylesheet.

Cheers,
Dan

Offline

 

#2 2005-07-14 09:39:34

dragoon
Member
From: Finland
Registered: 2005-05-18
Posts: 84

Re: More than one stylesheet for content_css

You can allways make a wrapper. Forexample a php file that includes all the styles you want and then include that php in content_css.

Offline

 

#3 2005-07-14 11:18:52

amohombe
Member
Registered: 2005-02-04
Posts: 49

Re: More than one stylesheet for content_css

dragoon wrote:

You can allways make a wrapper. Forexample a php file that includes all the styles you want and then include that php in content_css.

Sorry, but this is just an ugly hack.
IMHO, it should work with multiple css files 'directly on the client side'.
Even more, the entire CSS support must be improved, to allow the selection of styles based on their context - so an intelligent CSS styling.

Ahmed.

Offline

 

#4 2005-07-14 12:35:02

dragoon
Member
From: Finland
Registered: 2005-05-18
Posts: 84

Re: More than one stylesheet for content_css

I know its an ugly hack. No need to be sorry wink.

Offline

 

#5 2005-10-30 02:19:17

unfold
Member
Registered: 2005-10-09
Posts: 56

Re: More than one stylesheet for content_css

I'm running into the same "problem", as has this guy.

I'd like to use one stylesheet just in the editor so I can let a grid-background image show up only in the editor, to easily align images, divs, etc. At the same time I want to use my more general stylesheet.

Still, loving tinyMCE more and more.

Offline

 

#6 2005-10-30 13:45:16

johslind
Member
From: Denmark
Registered: 2005-03-24
Posts: 42
Website

Re: More than one stylesheet for content_css

unfold wrote:

I'd like to use one stylesheet just in the editor so I can let a grid-background image show up only in the editor, to easily align images, divs, etc. At the same time I want to use my more general stylesheet.

Maybe you could do like this:
Make two different style sheets, one for your site in general and one for TinyMCE.
They should be identical, except that the one for Tiny should have a body-definition somewhat like this:

body {
background-image: url(http://hobugt.dk/fusion3/images/firkant.gif);
background-repeat: repeat;
}

You would insert your own url instead of mine.
The firkant.gif is just a small white square with a grey border.
You could try it at http://hobugt.dk/fusion3/ in Discussion forum.
Log in as 'test' with the password '123456'.


Kindly,
Johs. Lind

Offline

 

#7 2005-11-01 16:55:04

unfold
Member
Registered: 2005-10-09
Posts: 56

Re: More than one stylesheet for content_css

First of all, thanks for the advice, I appreciate it.

I made a PHP stylesheet mixfile two days ago and it's working fine, it jsut loads the normal stylesheet and attaches a little bit at the beginning that has a body background script exactly like you proposed.

In this thread I learnt that the content_css path is relative to the file you are opening in tinyMCE:
http://tinymce.moxiecode.com/punbb/view … hp?id=1193

so that could also be usefull somehow maybe.


The PHP inside the mix-file:

$includeme = $_SERVER['DOCUMENT_ROOT']."/site/globalsheet.css"; if (file_exists($includeme)) {include($includeme);}
$includeme = $_SERVER['DOCUMENT_ROOT']."/site/editorsheet.css"; if (file_exists($includeme)) {include($includeme);}

Offline

 

#8 2006-01-04 20:31:02

hstraf
Member
Registered: 2005-09-29
Posts: 139

Re: More than one stylesheet for content_css

I don't understand how you are doing this.  Where does the mix-file "live"?  How is it executed?

Thanks!

Offline

 

#9 2006-05-19 03:08:53

stevenu
Member
Registered: 2006-05-19
Posts: 1

Re: More than one stylesheet for content_css

I have used this quick php script to modify my default stylesheet (test.css)

its not too elegant but works as a quick and dirty fix for anyone who wants it

<?  // this file called editorstylesheet.css.php
    header("content-type: text/css");
    $fc=file("test.css");
    foreach($fc as $line){
        if(!strpos($line,"##not editor##") > 0){
            echo($line);
        }
    }
?>

in your tinyMCE init code put
content_css : "[path to css folder]editorstylesheet.css.php",

in your style sheet  put something like (all lines with ##not editor## will not be shown)

body {
    background: url("../images/page-bg.gif"); /* ##not editor## */
    background-repeat: no-repeat;
    background-color: #fff;
}

you can also do blocks of editor only css like this

/* ##not editor##
some{
   editor only css
   block
   here
}

##not editor## */

Offline

 

#10 2006-05-19 19:02:12

nikoftime
Member
Registered: 2006-05-19
Posts: 4

Re: More than one stylesheet for content_css

Is it possible to use an absolute url path (eg '/path/to/css.php') to load the content_css file? I have been trying to do this, with no luck.

Offline

 

#11 2006-05-30 00:01:16

hstraf
Member
Registered: 2005-09-29
Posts: 139

Re: More than one stylesheet for content_css

Just use php or javascript to add the domain/hostname to your path. Shouldn't be hard to do.

Offline

 

#12 2007-06-27 23:30:27

groovenectar
Member
Registered: 2005-06-08
Posts: 22

Re: More than one stylesheet for content_css

I see nothing wrong with using a PHP script to do it just for the editor, if it would work. I just tried it with and without a query string and it did not work. The script itself works fine, it consolidates and displays the CSS, uses the proper headers, etc. TinyMCE just ignores it. No idea.

Offline

 

#13 2007-06-28 12:42:55

kempelen
Member
Registered: 2007-03-06
Posts: 57

Re: More than one stylesheet for content_css

This is a very old thread. Maybe content_css did not handle comma separated list back then?  I use this setting:

content_css : "/script/default.css,/site/TemplateA/standard.css,/default.aspx?__ShowStyleSheet=1"

Thus no need to concatenate css files together. And as you can see, last one is a dynamic one and yes, works well, so keep on trying. :-)

Additionally, from our style library I change the last CSS file URL in the DOM something like /default.aspx?__ShowStyleSheet=1&revision=N where N is increased by every edit of the css file, and tinyMCE (or the browser) reloads it correctly (in FF for now). (I do the change in tinyMCE getDoc() document's DOM.)

Offline

 

#14 2007-06-28 20:48:22

groovenectar
Member
Registered: 2005-06-08
Posts: 22

Re: More than one stylesheet for content_css

Wow, thanks... yeah I'm not sure what was up with the PHP solution, but this is obviously a better way to go. I thought it was a problem with dynamic files, but it turns out that it's not importing any files at all. I'll have to piddle around with that.

I overlooked this feature in the documentation!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB