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.
The forum operates in read-only mode. Please head to StackOverflow for support.
About cookies on this site
We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements.
About cookies on this site
Cookies used on the site are categorized and below you can read about each category and allow or deny some or all of them. When categories than have been previously allowed are disabled, all cookies assigned to that category will be removed from your browser. Additionally you can see a list of cookies assigned to each category and detailed information in the cookie declaration.
Necessary cookies
Some cookies are required to provide core functionality. The website won't function properly without these cookies and they are enabled by default and cannot be disabled.
CookieHub is a Consent Management Platform (CMP) which allows users to control storage and processing of personal information.
Cloudflare is a global network designed to make everything you connect to the Internet secure, private, fast, and reliable.
Preferences
Preference cookies enables the web site to remember information to customize how the web site looks or behaves for each user. This may include storing selected currency, region, language or color theme.
Analytical cookies
Analytical cookies help us improve our website by collecting and reporting information on its usage.
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic.
Hotjar is a product experience insights platform that gives you behavior analytics and feedback data to help you empathize with and understand your customers.
Clarity is a user behavior analytics tool that helps you understand how users interact with your website.
Marketing cookies
Marketing cookies are used to track visitors across websites to allow publishers to display relevant and engaging advertisements. By enabling marketing cookies, you grant permission for personalized advertising across various platforms.
Google Ads is an advertising service by Google for businesses that want to display ads on Google search results and its advertising network.
YouTube is a free video sharing website that makes it easy to watch online videos.
Microsoft Advertising (formerly Bing Ads) is a service that provides pay per click advertising on the Bing, Yahoo!, and DuckDuckGo search engines.
Other cookies
The cookies in this category have not yet been categorized and the purpose may be unknown at this time.
Cookies used on the site are categorized and below you can read about each category and allow or deny some or all of them. When categories than have been previously allowed are disabled, all cookies assigned to that category will be removed from your browser. Additionally you can see a list of cookies assigned to each category and detailed information in the cookie declaration.
Necessary cookies
Some cookies are required to provide core functionality. The website won't function properly without these cookies and they are enabled by default and cannot be disabled.
Name | Hostname | Vendor | Expiry |
---|---|---|---|
url-tracker | .ckeditor.com | 400 days | |
_vwo_uuid_v2 | .ckeditor.com | Visual Website Optimizer | 366 days |
Calculates Unique Traffic On a website | |||
__cfruid | .calendly.com | Cloudflare, Inc. | Session |
This cookie is set by Cloudflare for rate limiting policies. | |||
utm-touches | .ckeditor.com | 7 days | |
cookiehub | .ckeditor.com | CookieHub | 365 days |
Used by CookieHub to store information about whether visitors have given or declined the use of cookie categories used on the site. | |||
_cfuvid | .calendly.com | Session | |
Used by Cloudflare WAF to distinguish individual users who share the same IP address and apply rate limits | |||
__cf_bm | .g2crowd.com | Cloudflare, Inc. | 1 hour |
The __cf_bm cookie supports Cloudflare Bot Management by managing incoming traffic that matches criteria associated with bots. The cookie does not collect any personal data, and any information collected is subject to one-way encryption. | |||
_vwo_sn | .ckeditor.com | 1 hour | |
Stores session-level information. (VWO) | |||
_vis_opt_s | .ckeditor.com | 100 days | |
The number of times the browser was closed and reopened. Tracks sessions created for a user. (VWO) | |||
_vis_opt_test_cookie | .ckeditor.com | Session | |
Session cookie generated to detect if the cookies are enabled on the browser of the user or not. It also helps in tracking the number of browser sessions a visitor has gone through. (VWO) | |||
__cf_bm | .calendly.com | Cloudflare, Inc. | 1 hour |
The __cf_bm cookie supports Cloudflare Bot Management by managing incoming traffic that matches criteria associated with bots. The cookie does not collect any personal data, and any information collected is subject to one-way encryption. |
Preferences
Preference cookies enables the web site to remember information to customize how the web site looks or behaves for each user. This may include storing selected currency, region, language or color theme.
Name | Hostname | Vendor | Expiry |
---|---|---|---|
VISITOR_INFO1_LIVE | .youtube.com | 180 days | |
Set by YouTube and used for various purposes, including analytical and advertising. | |||
VISITOR_PRIVACY_METADATA | .youtube.com | 180 days |
Analytical cookies
Analytical cookies help us improve our website by collecting and reporting information on its usage.
Name | Hostname | Vendor | Expiry |
---|---|---|---|
_ga | .ckeditor.com | 400 days | |
Contains a unique identifier used by Google Analytics to determine that two distinct hits belong to the same user across browsing sessions. | |||
_hjSessionUser_ | .ckeditor.com | Hotjar | 365 days |
Hotjar cookie. This cookie is set when the customer first lands on a page with the Hotjar script. It is used to persist the Hotjar User ID, unique to that site on the browser. This ensures that behavior in subsequent visits to the same site will be attributed to the same user ID. | |||
_hjSession_ | .ckeditor.com | Hotjar | 1 hour |
Used by Hotjar to hold current session data. | |||
_zitok | .ckeditor.com | 365 days | |
MUID | .bing.com | Microsoft | 390 days |
Microsoft User Identifier tracking cookie used by Bing Ads. It can be set by embedded microsoft scripts. Widely believed to sync across many different Microsoft domains, allowing user tracking. | |||
CLID | www.clarity.ms | Microsoft | 365 days |
Identifies the first-time Clarity saw this user on any site using Clarity. | |||
_clck | .ckeditor.com | Microsoft | 365 days |
Persists the Clarity User ID and preferences, unique to that site, on the browser. This ensures that behavior in subsequent visits to the same site will be attributed to the same user ID. | |||
SM | .c.clarity.ms | Microsoft | Session |
This cookie is installed by Clarity. The cookie is used to store non-personally identifiable information. The cookie is used in synchronizing the MUID (Microsoft unique user ID) across Microsoft domains. | |||
MUID | .clarity.ms | Microsoft | 390 days |
Microsoft User Identifier tracking cookie used by Bing Ads. It can be set by embedded microsoft scripts. Widely believed to sync across many different Microsoft domains, allowing user tracking. | |||
MR | .c.bing.com | Microsoft | 7 days |
Used by Microsoft Clarity to indicate whether to refresh MUID. | |||
_clsk | .ckeditor.com | Microsoft | 1 day |
Connects multiple page views by a user into a single Clarity session recording. | |||
MR | .c.clarity.ms | Microsoft | 7 days |
Used by Microsoft Clarity to indicate whether to refresh MUID. | |||
_vwo_uuid | .ckeditor.com | 365 days, 6 hours | |
It generates a unique id for every visitor and is used for the report segmentation feature in VWO, and it also allows you to view data in a more refined manner. (VWO) | |||
_vwo_ds | .ckeditor.com | 30 days | |
Stores persistent user-level data for Track (goals, funnels) and Analyze (heatmaps, recordings, form analytics) (VWO) |
Marketing cookies
Marketing cookies are used to track visitors across websites to allow publishers to display relevant and engaging advertisements. By enabling marketing cookies, you grant permission for personalized advertising across various platforms.
Name | Hostname | Vendor | Expiry |
---|---|---|---|
_gcl_au | .ckeditor.com | Google Advertising Products | 90 days |
Used by Google AdSense to understand user interaction with the website by generating analytical data. | |||
_ga_ | .ckeditor.com | 400 days | |
Contains a unique identifier used by Google Analytics 4 to determine that two distinct hits belong to the same user across browsing sessions. | |||
YSC | .youtube.com | Session | |
This cookie is set by YouTube video service on pages with YouTube embedded videos to track views. | |||
IDE | .doubleclick.net | Google Advertising Products | 390 days |
Used by Google's DoubleClick to serve targeted advertisements that are relevant to users across the web. Targeted advertisements may be displayed to users based on previous visits to a website. These cookies measure the conversion rate of ads presented to the user. | |||
SRM_B | .c.bing.com | Microsoft | 390 days |
This cookie is installed by Microsoft Bing. Identifies unique web browsers visiting Microsoft sites. | |||
MSPTC | .bing.com | Microsoft | 390 days |
ANONCHK | .c.clarity.ms | Microsoft | 1 hour |
Used to store session ID for a users session to ensure that clicks from adverts on the Bing search engine are verified for reporting purposes and for personalisation | |||
_uetsid | .ckeditor.com | Microsoft | 1 day |
This cookie is used by Bing to determine what ads should be shown that may be relevant to the end user perusing the site. | |||
_uetvid | .ckeditor.com | Microsoft | 390 days |
Used by Microsoft Advertising to store a unique, anonymized visitor ID to personalize marketing. | |||
test_cookie | .doubleclick.net | 1 hour | |
Used to check if the user's browser supports cookies |
Other cookies
The cookies in this category have not yet been categorized and the purpose may be unknown at this time.
Name | Hostname | Vendor | Expiry |
---|---|---|---|
visitor_id1018062 | info.ckeditor.com | 365 days | |
visitor_id1018062-hash | info.ckeditor.com | 365 days | |
lpv1018062 | info.ckeditor.com | 1 hour | |
visitor_id1018062 | ckeditor.com | 365 days | |
visitor_id1018062-hash | ckeditor.com | 365 days | |
visitor_id1018062 | .pardot.com | 365 days | |
visitor_id1018062-hash | .pardot.com | 365 days | |
__Host-CKBox-Auth | api.ckbox.io | 41 days, 17 hours | |
CKBox-Auth | api.ckbox.io | 41 days, 17 hours | |
cp.context | portal.ckeditor.com | Session | |
__Host-next-auth.csrf-token | portal.ckeditor.com | Session | |
__Secure-next-auth.callback-url | portal.ckeditor.com | Session | |
visitor_id1018062 | portal.ckeditor.com | 365 days | |
visitor_id1018062-hash | portal.ckeditor.com | 365 days |
Re: Insert PHP code?
FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ;
in fckconfig.js
Re: Insert PHP code?
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.
How to do this?
(I attatched the source-code viewed in Firefox so you can see what i mean...)
Attachments:
Re: Insert PHP code?
Re: Insert PHP code?
Re: Insert PHP code?
Re: Insert PHP code?
Re: Insert PHP code?
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
Re: Insert PHP code?
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
Re: Insert PHP code?
Change the html extention to php, then enter your php code in view source eg.
Re: Insert PHP code?
any ideas?
Re: Insert PHP code?
I mean...
Re: Insert PHP code?
Ex: When you include in database, the code go like <?php echo "Hello"; ?> - and that's fine, that's ok.
then, when you get the code from database you show like <?php echo $content; ?> $content is your code from database
the problem is you try to show the PHP code like <?php echo " <?php echo "Hello"; ?> "; ?> and this is the big problem, at the code source you will see the <?php echo "Hello"; ?> (in pink color),
all what you need to do is to create an .php page from your database content and then to include in your page , ex:
$content - is your code from database.
$link = "test.php";
$fp = fopen($link, 'w');
fwrite($fp, $content);
fclose($fp);
include ("test.php");
Then the php code will be processed well by your server.
Enjoy.
Re: Insert PHP code?
Hi All,
I have same problem. I can put php-code into DB succesfully, and inside narmal-text and only php-code. php-code is executed on the site is well. But when I want to edit it and load in editor, php-code invisible.
So, that even if the page was php-code, then it must be re-inserted each time when editing. How to solve this problem?
sorry for my english
Re: Insert PHP code?
Re: Insert PHP code?
fwrite($fp, $content);
statement, this is for files (myfile.txt, myfile.php, myfile.html).
to ouput from a database see sample below:
$user_name = "root";
$password = "";
$database = "addressbook";
$server = "127.0.0.1";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT * FROM tb_address_book";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
print $db_field['ID'] . "<BR>";
print $db_field['First_Name'] . "<BR>";
print $db_field['Surname'] . "<BR>";
print $db_field['Address'] . "<BR>";
}
mysql_close($db_handle);
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
Re: Insert PHP code?
use tag <phpcode></phpcode> and insert php codes between these tags in your admin panel where u r using fckeditor
e.g.
and use below function to print your output
in above example, only one instance of php can be executed, i have used the above code on my "contact us" page where i have created the form in fckeditor and used php mail function on that page through fckeditor so i have not give so much time to write code for multiple instances
thanks
Re: Insert PHP code?
Re: Insert PHP code?
-------
Alright, I think I figured out how to scale shahidmau's function. Using this modification, you can now enter as many different PHP code snippets as you want into the source view of CKeditor. Each snippet is interpreted (evaluated) by PHP and rendered as such.
The main difference is that preg_match_all is used instead of preg_match and most of the variables are now arrays. The preg_replace function is also limited to one (1) replacement per iteration.
I'm not a PHP-guru by any means (!), so please offer modifications to make this more efficient etc.
Call the function and output your content with something like the following:
Re: Insert PHP code?
<?php include"save.php"; ?>
into the source of the page FCKeditor is managing and it completely removes the tag once I leave source mode and return to wysiwyg view... or if I publish the page from source mode and then go back to open it again, it will then remove the php includes link.
Its also doing the same thing on a simple css rollover link:
<a id="oa" href="products-oa.php" title="OA"></a>
Very frustrating!
*** I tried the above recommendation about coding it like this:
<phpcode><?php include"save.php"; ?></phpcode>
but it did not work, everything between the <phpcode> tag is removed upon returning to preview mode.