Page 1 of 2
Tags are changing to HTML entities
Posted: Sat Nov 17, 2007 6:07 am
by cnymike
In either TinyMCE or FCKeditorX, tags are changing, causing smarty errors when the page is displayed in the browser.
Example: I've got this code in the page...
Code: Select all
{if $ccuser->LoggedIn()} Welcome {$customcontent_loginname}
But as soon as I apply or submit the page and view the page, I get smarty errors like this...
Code: Select all
string(131) "Smarty error: [in content:content_en line 1]: syntax error: unidentified token ';LoggedIn()' (Smarty_Compiler.class.php, line 1407)"
Parse error: syntax error, unexpected '&' in /usr/www/users/cnymike/bsatroop666/tmp/templates_c/71^%%70^707^707A8977%%content%3Acontent_en.php on line 5
The code...
Code: Select all
{if $ccuser->LoggedIn()} Welcome {$customcontent_loginname}
has changed to this...
Code: Select all
{if $ccuser->LoggedIn()} Welcome {$customcontent_loginname}
When I "Select WYSIWYG to use: None" in User preferences, the problem goes away. But this is not a solution to the problem. It is necessary for WSYWIG to be fully operational for users of CMSMS sites.
There has been brief discussion of this issue but no resolution. How about a resolution?
Re: Tags are changing to HTML entities
Posted: Sat Nov 17, 2007 6:18 am
by cnymike
I have no idea what I'm doing with PHP but I was just screwing around and tried something...
I changed the WSYWIG User Preferences back to FCKeditorX and then went back to the page I was working on and started messing with the tag coding.
Instead of this tag,
I tried this...
This worked! Why did this work?
Is "{if $ccuser->LoggedIn()}" incorrect syntax?
Is "{if $ccuser-'LoggedIn()'}" correct PHP syntax?
Re: Tags are changing to HTML entities
Posted: Sat Nov 17, 2007 6:22 am
by calguy1000
That's not php syntax, it's smarty syntax (which at some times looks like php). and I'm not sure if it is or not, but I'd be interested to know.
does that syntax work when you turn the wysiwyg off all together?
Re: Tags are changing to HTML entities
Posted: Sat Nov 17, 2007 2:08 pm
by cnymike
Calguy, when "Select WYSIWYG to use:" is set to none, both syntaxes work.
When "Select WYSIWYG to use:" is set to either FCKEditorX or tinyMCE, this syntax works:
{if $ccuser-'LoggedIn()'}
When "Select WYSIWYG to use:" is set to either FCKEditorX or tinyMCE, this syntax does not work[/b]:
{if $ccuser->LoggedIn()}. With that syntax, the ">" is being changed to the HTML entity ">" which obviously results in a smarty error.
Re: Tags are changing to HTML entities
Posted: Sat Nov 17, 2007 2:13 pm
by tsw
I bet $ccuser-'LoggedIn()' evals to something like 0x12345-LoggedIn()
which evals to true value for some strange reason...
or there is more to smarty than I know

Re: Tags are changing to HTML entities
Posted: Sat Nov 17, 2007 2:15 pm
by streever
hey,
i actually think you should have to turn off the wysiwig to enter the code:
unless, you disable the setting in it, which converts symbols to the proper character
I don't want my clients to have to type in & for every ampersand: I'd rather that the wysiwig converted, and if an advanced user wants to drop in a tag, they use a "UDT" or a plugin.
Re: Tags are changing to HTML entities
Posted: Sat Nov 17, 2007 2:24 pm
by cnymike
calguy, I did look here,
http://smarty.php.net/manual/en/language.function.if.php
but didn't really see an example similar to what I've reported.
Re: Tags are changing to HTML entities
Posted: Mon Nov 19, 2007 2:01 pm
by cnymike
I posted this problem in the smarty forum and finally got a reply that may shed light on this...
http://www.phpinsider.com/smarty-forum/viewtopic.php?p=46051#46051
IMHO, the WYSIWYG is escaping the text given in module to show a valid template source.
Have you tried other HTML tags ? (like and other?)
If you can edit the page files via ftp? Try to make it Smile
Not sure if that reply makes sense to me, but maybe it will make sense to one of the developers.
Michael
Re: Tags are changing to HTML entities
Posted: Tue Dec 04, 2007 6:10 pm
by pbrady
Hi,
I am also having problems with this and this issue is driving me crazy. I have gone through dozens of postings for CMSMS and have no clear answer.
I am not a coder, and am trying to write simple code that works with my CMS to display different content to end users depending on their access level.
What I use is:
{if $ccuser->loggedin() && $ccuser->memberof('UserInput')}
blah blah blah
{elseif $ccuser->loggedin() && $ccuser->memberof('restricted')} Welcome logged in member of restricted. You are not allowed to see this information as a member of the group restricted.
{else} You are not authorized to see this information. You must log in and belong to an authorized group. {/if}
However, what I get instead (due to html entity conversion) is this:
{if $ccuser->loggedin() && $ccuser->memberof('UserInput')}
blah blah blah
{elseif $ccuser->loggedin() && $ccuser->memberof('restricted')} Welcome logged in member of restricted. You are not allowed to see this information as a member of the group restricted.
{else} You are not authorized to see this information. You must log in and belong to an authorized group. {/if}
Can some please tell me how to prevent this from happening? I am not a coder...so please be kind to me.

Re: Tags are changing to HTML entities
Posted: Tue Dec 04, 2007 6:23 pm
by cnymike
And of course, this is the exact same behavior I have been talking about. It is aggravating and since I don't have a clear picture of what is changing the text to entities, I don't know where to begin solving this problem either. As one of the replies to my original thread said, it was the WYSYWIG doing it. Great. So what? Is that behavior a bug or a "feature"? If it is a bug, where can it be fixed? If it is a "feature" what is the workaround?
Re: Tags are changing to HTML entities
Posted: Tue Dec 04, 2007 6:28 pm
by calguy1000
I would consider it a 'feature' of the wysiwyg..... and I think that if you're putting logic into your page content then you should be disabling the wysiwyg anyways.
but, either way, have you checked looking at the tinymce website to see any solutions.
Re: Tags are changing to HTML entities
Posted: Tue Dec 04, 2007 6:41 pm
by cnymike
So when using the templates built-in to the admin interface for FEU, for instance, we should as a general rule not be cutting and pasting that code into a page, but should instead.... do what?
I can't speak for the other poster in this thread, but I feel like answers to valid questions are answered with riddles sometimes instead of just an answer. Like the reply, "have you checked looking at the tinymce website to see any solutions.". Yes, I have. And what I see in preferences is this...
Encoding of entities: Raw encoding, named encoding or numeric encoding.
what I don't see is "no encoding" which is apparently the solution we seek. I can also see the option to not use WYSYWYG at all. But 99% of the time I do want WYSYWIG so this option to simply turn off WYSYWYG isn't too attractive either. So can something be escaped so WYSYWYG doesn't change it to entities?
All I want is some sort of clear answer. If there is no clear answer then fine. Just say so.
Re: Tags are changing to HTML entities
Posted: Tue Dec 04, 2007 7:21 pm
by pbrady
Hi CalGuy,
I did look on the smarty web site extensively and found no clear answer. I posted there too...but no answer.
I do not, by the way, have a problem using code only.
However, the problem for me is that I'm designing this CMS for use in a department of folks that have no idea what an HTML tag is, nevermind a smarty tag.
So I was hoping to find a solution within the context of the WSYWIG. Without one, I'm going to have to explain to end users to not enable or use WSYWIG on pages with 'smarty' code in them. That could get ugly.
However, you just gave me an idea...is it possible to reference a separate script from an HTML page that will load the smarty syntax in question? I'm not a programmer, mind you, but what about an include statement of some sort within CMSMS that will include the smarty syntax and bypass the entity conversion of the WSYWIG???
What do you think? I already tried global content blocks and that (sadly) did not work.
Is there a smarty type of include statement that could perhaps do the same thing?
-p
Re: Tags are changing to HTML entities
Posted: Wed Dec 05, 2007 12:59 am
by calguy1000
if you're going to be giving the client access to be able to edit the content on the page, then your probably don't want logic in your page content at all. or the client will have the access to mess this up.
I recommend you put your logic into the page template... then the wysiwyg can encode > into > all it wants and it won't mess up your code. I've posted numerous topics on the forum about how to do this stuff.
Re: Tags are changing to HTML entities
Posted: Wed Dec 05, 2007 3:29 am
by calguy1000
Well.... {if $ccuser_loggedin gt 0} bleh {/if} would work too...
But the point I was trying to make is:
If you're going to be giving content editing permission to your users, then you shouldn't be putting logic into the
content blocks, or users could mess up the functionality of your site. Instead, logic should go into the page template.
Unless you're only going to give them content editing functionality on certain pages
In which case, as an administrator, you can turn off the wysiwyg for your account,
(the user can still have the wysiwyg for his account to edit the content on the pages that he/she has access to),
put as much smarty logic into your content blocks as you want on the pages that your users won't have access to
and everybody is happy.