We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Unexpected T_STRING error with WYSIWYG fields containing HTML

Development and Programming

Shuhab's avatar
Shuhab
20 posts
16 years ago
Shuhab's avatar Shuhab

Hi,

I have no idea why this is happening since I was sure everything was working perfectly yesterday. I have a WYSIWYG field using LG_TinyMCE configured with forced_root_block : ‘p’ (by default) and this seems to mess things up when you want to use PHP in the template.

The template is set to allow PHP and the parsing stage is set on output. In a simple test where I do a <?php echo ‘{subpage_corner_box_text}’; ?> I get an parse error stating there is an unexpected T_STRING. If I do a <?php echo ‘test’; ?> I don’t get any errors. I have written test in the WYSIWYG field and can see that it contains test when using the HTML button from the options bar.

I can’t see how this is the fault of LG_TinyMCE.

I would assume that {subpage_corner_box_text} would just be replaced with text and since it is surrounded with quotes everything should be okay, but this doesn’t seem to be the case.

I need to get this fixed as soon as possible.

Moved to Extensions: Discussion and Questions by Moderator

       
Shuhab's avatar
Shuhab
20 posts
16 years ago
Shuhab's avatar Shuhab

Okay, I am getting closer to finding out what the real issue is. I disabled PHP to see what was being output for PHP to process and I could see that TinyMCE was NOT converting quotes into HTML entities. This made PHP barf up understandably. Now I need to configure LG_TinyMCE to do proper entity conversion. Any help is greatly appreciated.

       
Shuhab's avatar
Shuhab
20 posts
16 years ago
Shuhab's avatar Shuhab

Tried many different things and finally had to resort to a quick and dirty hack. If somebody has a better solution I would greatly appreciate it.

Here is my fix:

In tiny_mce_src.js at line 4230 add the following:
h = h.replace(/[\']/g, '''); // Replace ' with entity number '
h = h.replace(/[\"]/g, '"'); // Replace " with entity number "

This fixed the output from TinyMCE, so I could use it with PHP. I haven’t experienced any problems with this, but others might have a different experience.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Shuhab, support for third party addons is done by the author of the addon. In this case it would be Leevi Graham. Moving to the Extensions forum.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.