Dealing with PHP code stored in database with CakePHP -


I started using php a few hours ago. To begin the study, I decided to bake a small web app focused on the administration of the code snippets, some very simple all CRUD operations are acting like a magic problem is:

User application Will add any type of code to It works while adding snippets to any programming language other than PHP. When I use the model :: find () method, the PHP code (from the snippet of the code stored in the database) is replaced with an empty string and I can not display it in the view.

Why is this happening and how can I solve it?

Thanks for reading.

Perhaps you are not seeing output in the browser because the browser is php & lt;? Tries to hand over? & Gt; As HTML tags you will need to avoid code for output in the browser:

  & lt; Pre & gt; & Lt; Code & gt; & Lt ;? Php echo htmlentities ($ model ['model'] ['code']); ? & Gt; & Lt; / Code & gt; & Lt; / Pre & gt;    

Comments