Jump to content

[SOLVED] Printing code examples


nuttycoder

Recommended Posts

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

 

If i type in some php code even basic stuff like

Code:

<?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 safe values like:

 

 

<?php echo date ('Y'); ?>

 

 

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

Thanks

Link to comment
Share on other sites

got it working i can post code and it shows. I had to disable the tinymce editor for it to work, so i'll either hve to find a way round it with thi editor or find another.

 

Thanks

 

btw even without the editor in place i can post code save it and then view it on the page showing the tutorial only when i go to edit the information again i have to type in code and /code each time it seems to get stripped any idea why?

 

I can see code and /code inthe db using phpmyadmin but its not there when i go to edit the tutorial using my php script

Link to comment
Share on other sites

Been experimenting with diffrent settings on the tinymce and if I turn the editor into basic mode I can post code and it shows up turning all code typed into the html safe version and also able to have the normal html tags <p>,< b>..ect using the editor which is exacly what i need.

 

Thanks for everyone who's helped me with this at the very least I've learn't useful ways of using htmlspecialchars & expressions,

 

While learing something new its never been a wasted time  ;D

 

Thanks again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.