You are viewing the PKP Support Forum | PKP Home Wiki

Solution: TinyMCE buttons disappear under non-canonical URL

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Solution: TinyMCE buttons disappear under non-canonical URL

Postby Laird » Fri Mar 07, 2014 8:06 am


I just helped a friend to resolve a problem he was having with his new OJS installation, and I wanted to document it here in case it helps anyone else.

The problem is that when he accessed his OJS installation under its non-canonical URL, the TinyMCE editing buttons wouldn't show. I understand that because there *is* a canonical URL setting in config.inc.php, accessing OJS under non-canonical URLs isn't necessarily supported, but in any case, here's the problem and the solution for anyone who wants to try it regardless.

The base script path for OJS was different under each of my friend's URL schemes; those two schemes being something like this:


The problem then was that in lib/pkp/lib/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php, the cache hash generated on line 162 doesn't include the tinyMCEPreInit.base value (generated from dirname($_SERVER["SCRIPT_NAME"])) of line 194, so that only one cache file is generated for both values of tinyMCEPreInit.base - the actual cached value depending simply on whichever URL scheme is accessed first. When the wrong cached file is served up, TinyMCE tries to load its CSS and image files from the wrong URLs, and thus its editing buttons don't show up.

There seem to be (at least) two possible solutions:

1. Edit that file so that the impending value of tinyMCEPreInit.base is added to the cache hash.
2. Turn off TinyMCE caching.

I chose the second solution, because it seemed better to edit a file native to OJS rather than one from upstream (TinyMCE). This involved editing line 369 of /public_html/journal/plugins/generic/tinymce/TinyMCEPlugin.inc.php so that disk_cache is set to false rather than to true.

I hope this helps anyone experiencing a similar problem.
Posts: 1
Joined: Fri Mar 07, 2014 8:03 am

Re: Solution: TinyMCE buttons disappear under non-canonical

Postby asmecher » Fri Mar 07, 2014 10:57 am

Hi Laird,

Thanks for writing this up in clear detail.

Note that you may experience other problems as a result of having two URLs, particularly when it comes to statistics; the statistics framework uses logfile URLs to match requests, so you may find that your statistics miss the part of the traffic coming from the non-canonical URL. (External statistics tools such as those based on web bugs, like Google Analytics, will suffer the same problem OTOH.)

Alec Smecher
Public Knowledge Project Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest