TinyMCE Not Rendering Content per CMSMS Stylesheets

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by JohnnyB »

I don't know if there is anything that would stop tinymce from loading the stylesheet or prevent the stylesheet from being available from within the tinymce iframe. But, here are some other things to check and some php.ini suggestions.

1) If running mod security or another mod sec or security filter or scanning on the site:
a) check the logs for that to see if there is anything mentioning the stylesheet or tinymce, etc.
b) turn it off and see what happens - any better?

2) Are you running this from a subdirectory? The phpinfo showed a /rochestercan/ as the where the phpinfo script was running from and I wonder if that is where CMSMS is installed. If so, could there be a problem with a redirect causing the stylesheet not to load in the iframe.

3) PHP Installation:
You might need fileinfo support enabled. I know for sure that some modules use this. Your host may need to first re-compile PHP with fileinfo.so before you simply add this extension to the php.ini file. Ask them if it is installed, if it is, then it can be enabled easily in php.ini. If not, then it has to be installed.

My recommended php.ini settings. There are some comments next to each one and you can Google them for more information. But, it seems Inmotion still doesn't set up there php.ini the way most production servers are compiled.... (I had to tweak out the php settings on my old inmotion vps too)

display_errors = Off # better security
enable_dl = Off # not needed
error_log = error_log # OR set to something that you can see in your public_html file. This will show you if there are any relevant PHP errors
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off # better security
html_errors = Off # better security
max_execution_time = 60 # on my inmotion vps, I had to have a really high value for this. I would start by putting this to 60
variables_order = GPCS # development servers usually use EGPCS. Production doesn't


I don't know... maybe one of these last things will be your golden egg
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote:I don't know if there is anything that would stop tinymce from loading the stylesheet or prevent the stylesheet from being available from within the tinymce iframe. But, here are some other things to check and some php.ini suggestions.

1) If running mod security or another mod sec or security filter or scanning on the site:
a) check the logs for that to see if there is anything mentioning the stylesheet or tinymce, etc.
b) turn it off and see what happens - any better?
Not running anything of this ilk. These are new, clean installs.
JohnnyB wrote:2) Are you running this from a subdirectory? The phpinfo showed a /rochestercan/ as the where the phpinfo script was running from and I wonder if that is where CMSMS is installed. If so, could there be a problem with a redirect causing the stylesheet not to load in the iframe.
Yes and no. The domain on which I'm working (RochesterCAN.org) is hosted as an add-on domain under the hosting account of the project's parent organization, Rochester Education Foundation (RochesterEducation.org). As an add-on domain, the root directory for RochesterCAN is, indeed, a subdirectory of the public_html directory for the hosting account. But as far as DNS is concerned, that subdirectory is the top-level directory for RochesterCAN.org.

Your thoughts?

(As a point of maybe-more-than-interest, I'll say that my clean manual install (that also shows the same misbehavior that spawned this thread) is, further, in a subdirectory under the RochesterCAN directory.)
JohnnyB wrote:3) PHP Installation:
You might need fileinfo support enabled. I know for sure that some modules use this. Your host may need to first re-compile PHP with fileinfo.so before you simply add this extension to the php.ini file. Ask them if it is installed, if it is, then it can be enabled easily in php.ini. If not, then it has to be installed.

My recommended php.ini settings follow.
Thanks for your helpful tips. I will pursue each this evening and report back soon.

All the best,
Jim
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote:My recommended php.ini settings:

display_errors = Off # better security
enable_dl = Off # not needed
error_log = error_log # OR set to something that you can see in your public_html file. This will show you if there are any relevant PHP errors
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off # better security
html_errors = Off # better security
max_execution_time = 60 # on my inmotion vps, I had to have a really high value for this. I would start by putting this to 60
variables_order = GPCS # development servers usually use EGPCS. Production doesn't

I don't know... maybe one of these last things will be your golden egg
I carefully modified my php.ini file to reflect all of your recommendations, but sadly I must report that the changes failed to produce any joy in TinyMCE land.

Sigh...

(Along the way I needed help from the tech at my host, who coached me to add a SuPHP_ConfigPath statement to my .htaccess file. That was a great lesson.)
Last edited by jlkane on Sat Dec 06, 2014 5:26 am, edited 1 time in total.
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

paulbaker wrote:Are you able to change host?
I neglected to reply to this question yesterday, Paul -- sorry.

I would say that changing hosts would be a choice of last resort. This new site (Rochester College Access Network) supports a project of the Rochester Education Foundation (REF), so we're hosting it as an add-on domain under REF's hosting account. It's a fairly complex installation -- several websites for other projects, an installation of Form Tools (an excellent forms-to-database tool), etc. -- so I'm reluctant to move the whole smash. I'm equally reluctant to move this single new project, in part because I'm reluctant to surrender over an issue that *should* be conquerable, and in part because I'm very happy with InMotion Hosting in *every* other way: uptime, support, and (most of all) page load times. InMotion Hosting's SSD-based infrastruction has proven to be really fast!

All of which leaves me in no rush to change hosts.
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

So here's an important new finding:

I went back to look more carefully at at the TInyMCE iframe using Firebug or Web Inspector, and while I see SEVERAL CMSMS-supplied stylesheets, NONE of them is the simple "test" stylesheet that I've linked to the "test" template:

<head xmlns="http://www.w3.org/1999/xhtml">

<base href="http://rochestercan.org/"></base>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"></meta>
<link href="http://rochestercan.org/modules/TinyMCE ... ontent.css" rel="stylesheet" type="text/css"></link>
<link href="http://rochestercan.org/modules/TinyMCE ... ontent.css" rel="stylesheet" type="text/css"></link>
<link href="http://rochestercan.org/modules/TinyMCE ... 1417632348" rel="stylesheet" type="text/css"></link>

</head>

So now the short definition of the problem we're facing is that TinyMCE isn't being fed the appropriate stylesheet. It doesn't appear to be a permissions-based failure to *read* the stylesheet, but rather a failure to get the link *to* TinyMCE.

The same test repeated with MicroTiny reveals a link to the appropriate stylesheet.

Your thoughts?
Last edited by jlkane on Sat Dec 06, 2014 5:51 am, edited 1 time in total.
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote: 1) If running mod security or another mod sec or security filter or scanning on the site:
a) check the logs for that to see if there is anything mentioning the stylesheet or tinymce, etc.
b) turn it off and see what happens - any better?
I reacted incorrectly to this question the other day, Johnny, because I didn't know what ModSecurity is. I did a little research tonight, then asked InMotion Hosting whether they're running ModSecurity on our (shared) server. The answer is "yes."

If we can't get this working, I'll have them turn it off as the next step in our troubleshooting.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by JohnnyB »

Not running anything of this ilk. These are new, clean installs.
This is usually set up by the host and comes with many cpanel based servers. It isn't usually something that you would set up unless you manage a dedicated server or something similar.

So, the stylesheet with template id of 22 is not the correct one?
I would check the tmp directory and see if there is a TinyMCE static file there. If so, you can delete it in case it is loading something old pointing to the wrong stylesheet.

One thing you can try is to edit that file and enter the correct stylesheet id number. The reference to the stylesheet will be toward the bottom of the file.

If there is not a file there, you can checkmark the option to use a static config file, then look in the /tmp/ directory to find and edit the file in the same way I just mentioned.

It will be interesting to see if loads the stylesheet after making sure it is using the correct ID #.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote:So, the stylesheet with template id of 22 is not the correct one?
No. I was just examining MicroTiny in the manually-installed instance and saw that it was being fed two links to the appropriate stylesheet. Note the "...combined..." form of the link, typical of {cms_stylesheet} behavior, even when there is only a single attached stylesheet:

<link href="http://rochestercan.org/cmsms/tmp/cache ... 14c956.css" rel="stylesheet" type="text/css"></link>

<link rel="stylesheet" data-mce-href="http://rochestercan.org/cmsms/tmp/cache ... 14c956.css" href="http://rochestercan.org/cmsms/tmp/cache ... ss"></link>

If you follow that link, you'll see that it's the simple 3-style sheet you'd expect. None of the links being fed to TinyMCE are in this "combined" format or lead to my simple "test" stylesheet.
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote:I would check the tmp directory and see if there is a TinyMCE static file there. If so, you can delete it in case it is loading something old pointing to the wrong stylesheet.
Should I just empty the /tmp/cache directory entirely? ...or should I be selective?
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by JohnnyB »

Sorry for the confusion. I'll clarify what I meant.

When choosing the TinyMCE option that allows it to use a static config file (under the advanced settings), a tinymce config file will be saved on the server inside of the /tmp/ directory.

It basically contains javascript for the tinymce init function. There will be a line, near the bottom of the file that sets the path to the stylesheet ID or perhaps stylesheet IDs assigned to a page template.

The tinymce link to the cmsms stylesheet from one of your earlier posts is

Code: Select all

<link href="http://rochestercan.org/modules/TinyMCE/stylesheet.php?templateid=22&mediatype=screen&bogus=1417632348" rel="stylesheet" type="text/css"></link>
I think the templateid=22 would normally correspond to an actual stylesheet in your cms.

So, if templateid=22 is not the stylesheet that should load, then perhaps you can edit the static tinymce config file in the /temp/ directory to use the correct stylesheet and then be sure tinymce is set to use that static config file.

By the way, when editing a stylesheet or hovering your mouse over the edit link, you can see the template id.

Try this with your basic css and basic template test and see if manually editing the static config file makes the styles load up for your page. Let us know what results you get from trying that test.


Then, I think the next step is to see if tinymce can load more than one stylesheet. MicroTiny does things a slightly different way by grabbing the cached css file. If there is more than one stylesheet assigned to a template, the CMS attempts to combine them, when appropriate, and then save it as a static file on the server. MicroTiny grabs that file whereas TinyMCE loads the css directly from the stylesheet saved in the database.

I'd have to take a look at its code, but after seeing that there is more than one stylesheet assigned to a template and the older method that the tinymce module uses to load a stylesheet, it makes me wonder if tinymce is capable of loading multiple stylesheets.... I thought it does, but now I'm unsure.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by JohnnyB »

Should I just empty the /tmp/cache directory entirely? ...or should I be selective?
no, just look in the /tmp/ directory to see if there is a tinymce config file.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

Thanks for the very helpful and thorough clarification, Johnny. I'll work on that on Saturday afternoon (Eastern time, US).

Two thoughts WRT your concern about TinyMCE and multiple stylesheets:

1. I've created CMSMS sites with multiple stylesheets where TinyMCE works perfectly (on Bluehost and Arvixe).

2. My simple test page has a single simple stylesheet attached.

...so I don't think multiple stylesheets is the problem.

Off to bed now,
Jim
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote:When choosing the TinyMCE option that allows it to use a static config file (under the advanced settings), a tinymce config file will be saved on the server inside of the /tmp/ directory.

It basically contains javascript for the tinymce init function. There will be a line, near the bottom of the file that sets the path to the stylesheet ID or perhaps stylesheet IDs assigned to a page template.

The tinymce link to the cmsms stylesheet from one of your earlier posts is

Code: Select all

<link href="http://rochestercan.org/modules/TinyMCE/stylesheet.php?templateid=22&mediatype=screen&bogus=1417632348" rel="stylesheet" type="text/css"></link>
I think the templateid=22 would normally correspond to an actual stylesheet in your cms.

So, if templateid=22 is not the stylesheet that should load, then perhaps you can edit the static tinymce config file in the /temp/ directory to use the correct stylesheet and then be sure tinymce is set to use that static config file.

Try this with your basic css and basic template test and see if manually editing the static config file makes the styles load up for your page. Let us know what results you get from trying that test.
I'm back to report on the results of that experiment.

I began by setting TinyMCE to "Use Static Config File", I made a simple edit using TinyMCE, then logged out of the Admin panel.

Looking in the /tmp directory, I found the tinyconfig.js file to which you were referring. In it, I did indeed find a link to the stylesheet with templateid=22:

Code: Select all

content_css : "http://rochestercan.org/modules/TinyMCE/stylesheet.php?templateid=22&mediatype=screen&bogus=1417856011",
I edited that line to point instead at templateid=61 -- the id of my simple test stylesheet, logged back in to the Admin panel and went to edit my simple test page using TinyMCE. This change had no impact on the display of my content in TinyMCE, and when I reopened tinyconfig.js I found that the Tiny had "corrected" the content_css link to point to templateid=22 again.

So I think this experiment led to another dead end. Your thoughts?
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote:PHP Installation:
You might need fileinfo support enabled. I know for sure that some modules use this. Your host may need to first re-compile PHP with fileinfo.so before you simply add this extension to the php.ini file. Ask them if it is installed, if it is, then it can be enabled easily in php.ini. If not, then it has to be installed.
I worked with tech support at InMotion Hosting last night and got this response from them today via email:
As for the PHP fileinfo module, this module is not compiled into the PHP binary on our shared servers by default-- it would require you to upgrade to a VPS or higher, unfortunately.
I'm surprised by this response, as my research indicates that fileinfo was an extension until PHP 5.3, at which point it was installed and enabled by default. So InMotion Hosting has chosen not only not to enable fileinfo by default but simply to outlaw it in a shared environment. That seems strange, for a module that is said to be built-in and enabled by default. Any idea what might be behind that decision?

I've made a request to InMotion Hosting to provide access to an environment that includes fileinfo support, even if only for one day, for the purposes of carrying this investigation to its logical conclusion.

Your thoughts?
jlkane

Re: TinyMCE Not Rendering Content per CMSMS Stylesheets

Post by jlkane »

JohnnyB wrote: 1) If running mod security or another mod sec or security filter or scanning on the site:
a) check the logs for that to see if there is anything mentioning the stylesheet or tinymce, etc.
b) turn it off and see what happens - any better?
jlkane wrote:I asked InMotion Hosting whether they're running ModSecurity on our (shared) server. The answer is "yes."

If we can't get this working, I'll have them turn it off as the next step in our troubleshooting.
Last night, InMotion Hosting turned off ModSecurity for my hosting account. Unfortunately, doing so did not improve TinyMCE's behavior.

Heavy sigh...

But since the CMSMS team seems to take a dim view of ModSecurity, I guess I'm glad to have it turned off.
Locked

Return to “Modules/Add-Ons”