Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

SOLVED: TinyMCE problem - Javascript attempting to load .php file


Reply


357 Views

Avatar
jonathanc

Community Member, 1 Post

19 February 2014 at 11:22am

Edited: 19/02/2014 11:45am

Hi there,

New to SilverStripe and new to the forums.

I just installed a fresh version of Silverstripe on top of Ubuntu/Nginx/PHP/Mysql and so far everything has worked perfectly except for the following:

When I go to load the page editor, the page fails to load the TinyMCE Editor and inspector shows the error:

Uncaught SyntaxError: Unexpected token <

Essentially....

At the bottom of the page in the Javascript Includes area, there is an include attempting to load a .php file instead of a .js file and of course fails when the first line is "<?php"

<script type="text/javascript" src="/framework/thirdparty/tinymce/tiny_mce_gzip.php?m=1384281859&amp;js=1&amp;plugins=table,emotions,paste,media,fullscreen,inlinepopups,advimagescale&amp;themes=advanced&amp;languages=en&amp;diskcache=true&amp;src=false"></script>

Is this a failure on something else, or is there somewhere I can change it to load the .js file instead of the .php file.

Thanks!

------------------

Found a solution:

Under /framework/forms/HtmlEditorField.php i replaced the following block of code:

if(Config::inst()->get('HtmlEditorField', 'use_gzip')) {
$internalPlugins = array();
foreach($configObj->getPlugins() as $plugin => $path) if(!$path) $internalPlugins[] = $plugin;
$tag = TinyMCE_Compressor::renderTag(array(
'url' => THIRDPARTY_DIR . '/tinymce/tiny_mce_gzip.js',
'plugins' => implode(',', $internalPlugins),
'themes' => 'advanced',
'languages' => $configObj->getOption('language')
), true);
preg_match('/src="([^"]*)"/', $tag, $matches);
Requirements::javascript(html_entity_decode($matches[1]));

} else {
Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
}

with

Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');