spacepoet Posted December 13, 2012 Share Posted December 13, 2012 (edited) Hello: Does anyone use CKEditor? I want to insert PHP tags: <? echo $myVar; ?> via the RTE (Rich Text Editor) but I cannot get them to display on the website. I am inserting the data in an admin area so I am not worried about malicious code. When I display the data on the frontend it does not appear. But, when I view the source code it is showing the code as I entered it: <? echo $myVar; ?> rather than whatever the myVar is (Hello World, for example). Does anyone know why this is happening or have a solution? I thought maybe I could do a str_replace as I insert the data or display the data .. ?? INSERT $myVar = mysql_real_escape_string(str_replace(array('{%', '%}'), array('<?', '?>'), $_POST['myVar'])); Using a set of {% %} tags first, but this does not work the way I am doing it. Display: $myVar = $row['myVar']; Or, is there an encoding type I need to declare ..?? Anyone have any ideas? Edited December 13, 2012 by spacepoet Quote Link to comment https://forums.phpfreaks.com/topic/271938-ckeditor-and-php-tags-in-rte-rich-text-editor/ Share on other sites More sharing options...
MDCode Posted December 13, 2012 Share Posted December 13, 2012 Try changing the opening <? tag to <?php. Your php.ini settings might be affecting it Quote Link to comment https://forums.phpfreaks.com/topic/271938-ckeditor-and-php-tags-in-rte-rich-text-editor/#findComment-1399081 Share on other sites More sharing options...
NomadicJosh Posted December 13, 2012 Share Posted December 13, 2012 Also make sure to use <pre></pre> tags. Quote Link to comment https://forums.phpfreaks.com/topic/271938-ckeditor-and-php-tags-in-rte-rich-text-editor/#findComment-1399083 Share on other sites More sharing options...
trq Posted December 13, 2012 Share Posted December 13, 2012 PHP is not executed as it comes out of a database. Nor is it a good idea to store code in a database if you want it executed. Quote Link to comment https://forums.phpfreaks.com/topic/271938-ckeditor-and-php-tags-in-rte-rich-text-editor/#findComment-1399123 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.