Jump to:

23473 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » SOLVED: TinyMCE problem - Javascript attempting to load .php file

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

Page: 1
Go to End
Author Topic: 298 Views
  • jonathanc
    Avatar
    Community Member
    1 Post

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

    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');

    298 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.