Printing code examples

I am building a tutorial site, all is working apart from 1 thing.

If i type in some php code even basic stuff like <?php echo date ('Y'); ?>

then when its submitted into the database the php gets stripped away i’m using the tinymce editor if that helps make it clear.

I need to be able to show code examples as my tutorials are for web design does anyone know a way of showing code.

I can disable the tinycme editor and type code right into the textfeild and use the html save values like:

&lt;?php echo date ('Y'); ?&gt;

but thats not a good solution as i want to use the tinymce editor as my members will be able to write some tutorials

any help would be great

So basically you want to extend the functionality tinymce provides? Did you check out their support forums? And what have you tried yourself? The first thing that should pop into your mind in such a case would be to use either htmlspecialchars() or htmlentities() (please read up on both of these to decide which one works best in your situation).

Sponsor our Newsletter | Privacy Policy | Terms of Service