Insert PHP code?

This is the right place to exchange ideas, thoughts with our community.
Note: Click here for Feature Requests or Bug Reports.

Insert PHP code?

Postby amaranth » Fri Jan 23, 2009 10:30 am

Hi.

I'm trying to insert PHP Code within the source-code but it get's deleted right after switching back to normal mode. Is there any chance to insert such code?

Thanks and Regards.
amaranth
 
Posts: 5
Joined: Fri Jan 23, 2009 10:27 am

Re: Insert PHP code?

Postby georgesoft » Wed Jan 28, 2009 9:55 am

You have to uncomment line
FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ;
in fckconfig.js
georgesoft
 
Posts: 3
Joined: Wed Jan 28, 2009 9:37 am

Re: Insert PHP code?

Postby amaranth » Tue Feb 10, 2009 2:11 pm

I already did this but the code just doesn't get executed.

Viewing the source-code, the PHP-Code is visible. Apparently, it just gets "printed" into the source but is not beeing executed.

Example: I'm writing a normal text within FCKEditor and want to grab the current date.

Code: Select all
Today we have <?php
echo date("Y/m/d");
?>


How to do this?

(I attatched the source-code viewed in Firefox so you can see what i mean...)
Attachments
code.jpg
code.jpg (19.43 KiB) Viewed 4556 times
amaranth
 
Posts: 5
Joined: Fri Jan 23, 2009 10:27 am

Re: Insert PHP code?

Postby amaranth » Fri Feb 20, 2009 9:26 am

...
Last edited by amaranth on Wed Mar 25, 2009 4:59 pm, edited 1 time in total.
amaranth
 
Posts: 5
Joined: Fri Jan 23, 2009 10:27 am

Re: Insert PHP code?

Postby bjoernklein » Sat Feb 21, 2009 3:39 pm

Is it not being executed within the editor or on the output-page?
bjoernklein
 
Posts: 5
Joined: Fri Feb 20, 2009 12:41 pm

Re: Insert PHP code?

Postby amaranth » Sun Mar 15, 2009 3:57 pm

Neither within the editor nor on the output-page.
amaranth
 
Posts: 5
Joined: Fri Jan 23, 2009 10:27 am

Re: Insert PHP code?

Postby amaranth » Wed Mar 25, 2009 5:00 pm

Sorry for pushing - anybody got an idea?
amaranth
 
Posts: 5
Joined: Fri Jan 23, 2009 10:27 am

Re: Insert PHP code?

Postby poek » Mon Mar 30, 2009 5:41 pm

yeah, maybe you must choose the extension .php in place of .html or .htm or .asp
That shall work. your server must have php installed otherwise it wont work :lol:
poek
 
Posts: 1
Joined: Mon Mar 30, 2009 5:39 pm

Re: Insert PHP code?

Postby Error999 » Mon May 18, 2009 4:47 pm

Hi,

I had the same problem.

Do you use the "echo" command to print the website code?

If yes, you should use "eval", but you should close the php tag first when you eval you website, otherwise you get an error because eval try to open a php tag but it isn't closed at that point.

Error999
Error999
 
Posts: 2
Joined: Mon May 18, 2009 4:42 pm

Re: Insert PHP code?

Postby krp » Mon May 18, 2009 5:50 pm

Change the html extention to php, then enter your php code in view source eg.
Code: Select all
<?php echo "Hello World"; ?>

and call the output through a url e.g.
Code: Select all
http://yourdomain.com/output.php
. This has worked for me.
However I haven't got the editor to read the file back for editing again.
krp
 
Posts: 3
Joined: Mon May 18, 2009 4:30 pm

Next

Return to FCKeditor 2.x

Who is online

Users browsing this forum: No registered users and 8 guests