Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7559421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:37:58+00:00 2026-05-30T12:37:58+00:00

I’ve got a problem with one of my JavaScripts included in a Cake plugin

  • 0

I’ve got a problem with one of my JavaScripts included in a Cake plugin I’m developing. For some reason a JavaScript file is parsed as a PHP file, so loading the file throws this error, which is a PHP parsing error:

<b>Parse error</b>:  syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

The script is called using the HtmlHelper:

<?php echo $this->Html->script(array(
  '/myplugin/scripts/tiny_mce/tiny_mce',
)); ?>

The error is triggered by a compressed tiny_mce.js file which resides in a subdirectory in a scripts dir, the uncompressed version displays the same behaviour. The thing is that I haven’t got the problem on my local setup.

The remote server is running PHP 5.2.17 with mod_rewrite enabled, my Cake version is 1.3.10 – my test setup runs PHP 5.3.4 and the same version of Cake.
It could be a rewrite or permissions error, but my application functions fine otherwise and other scripts (including those in subdirectories and remote ones) load without problem.

EDIT:
After moving the tiny_mce directory out of the Cake installation and linking to it the JavaScript is parsed correctly. My guess it’s a bug relating to mod_rewrite and the handling of plugins, but I haven’t found other cases related to this behaviour.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:37:59+00:00Added an answer on May 30, 2026 at 12:37 pm

    I have also come across this issue, with exactly the same file: Tiny MCE JavaScript.

    This is due to the way that the CakePHP dispatcher handles files in a plugin’s webroot. It chooses to do a PHP include on files with CSS or JS extensions, and it just so happens that the tiny_mce.js file contains the characters <?, meaning that instead of just outputting JavaScript text it tries to parse the subsequent lines as PHP code. Unsurprisingly it fails!

    This has been raised as a bug on Lighthouse (CakePHP’s bug tracking system). The suggested fixes are:

    1. Create a symbolic link from the plugin webroot to the app webroot (e.g. app/webroot/tinymce => app/Plugin/TinyMCE/webroot)
    2. Turn off PHP short tags in your PHP INI – a good principle anyway

    In short, CakePHP may not fix this, as they want to maintain support for being able to include PHP code in JS/CSS files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.