spacepoet Posted December 13, 2012 Share Posted December 13, 2012 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? 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 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. 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. 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
Archived
This topic is now archived and is closed to further replies.