Hi guys,
i just want to ask you if it is possible to include php in the source code of a page created with fckeditor. when i change to the source code view an put in an php, fcke converts <?php to a commentar tag <!--
has anyone got an idea?
sven
i just want to ask you if it is possible to include php in the source code of a page created with fckeditor. when i change to the source code view an put in an php, fcke converts <?php to a commentar tag <!--
has anyone got an idea?
sven
RE: Use PHP Tags in FCKE
RE: Use PHP Tags in FCKE
RE: Use PHP Tags in FCKE
I've got to crack this problem, else will have to return to a simple textarea.
RE: Use PHP Tags in FCKE
I think it's got something to do with this file (in the _source) directory:
fckcodeformatter.js
However, when I tried to implement it into the compiled version (ie. fckeditorcode_gecko_1.js), the wywsiwyg fails to load. How do I add code to the comiled version without it failing to initiate?
I think we need something like:
FCKCodeFormatter.Regex.PhpTags = /\<\?PHP|<\?|\?\>/gi;
and
sFormatted = sFormatted.replace( this.Regex.PhpTags, '\n$&\n' ) ;
RE: Use PHP Tags in FCKE
FCKCodeFormatter.Regex.PhpTags = /(\<\?PHP|\<\?|\?\>)/gi;
RE: Use PHP Tags in FCKE
This has taken me all day and is only a partial solution but should help others.
In the _source directory (I'm still yet to compile it) in fck_1.js, replace the FCK.GetHTML function with this:
FCK.GetHTML = function( format )
{
var sHTML ;
if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
{
// TODO: Wait stable version and remove the following commented lines.
// if ( FCKBrowserInfo.IsIE )
// FCK.CheckRelativeLinks() ;
if ( FCKBrowserInfo.IsIE )
sHTML = this.EditorDocument.body.innerHTML.replace( FCKRegexLib.ToReplace, '$1' ) ;
else
sHTML = this.EditorDocument.body.innerHTML ;
}
else
sHTML = document.getElementById('eSourceField').value ;
// Keep our php intact!
sHTML = sHTML.replace(/\<\?(PHP)?/gi,'<\\?$1');
sHTML = sHTML.replace(/\?\>/gi,'\\?>');
if ( format )
return FCKCodeFormatter.Format( sHTML ) ;
else
return sHTML ;
}
When you post your form, the code should go through as
<\?php echo 't'; \?>
Notice the escaping question marks.
Now wrap this in addslashes(), which will be:
<\\?php echo \'t\'; \\?>
When you bring it back out the database, stripslashes() then string replace '<\?' and '\?>'
Best of luck.
RE: Use PHP Tags in FCKE
Example
<!--
-->
RE: Use PHP Tags in FCKE
stefan
RE: Use PHP Tags in FCKE
what I was trying to do and couldn't get it to work is to have a tag that remains untouched during the process. (Like SCRIPTs and STYLEs _source/fckxhtml.js )
So I would call this tag CODE and I can put my php there.
Does anyone know where in the source code it tells to avoid parsing whatever is inside SCRIPT and STYLE tag ?
Thanks,
MARTIN