Jump to content

[SOLVED] Code tags


ngreenwood6

Recommended Posts

I am trying to create a section on my website where users can submit php code. I am trying to get the code into the database and have it pull it back up later but I want the code section to be in a code like section. Does anyone know how I can accomplish this. I tried adding [c0de] and [/c0de] but it just parses it and shows the "[c0de]" when it is pulled from the database. Any help is appreciated.

 

Also can somebody tell me how to make it so that when a post is made that it will post it just how it was written. For example to make it read like a word document.

Link to comment
https://forums.phpfreaks.com/topic/131199-solved-code-tags/
Share on other sites

Well that is what I am trying to figure out. I am trying to set it up so that a user can make a post and they can use plain text and then the can select something like a code tag and it wrap everything in the code tag and store all the information in the database for further use. I having a problem trying to figure out how to get it to store the information and only apply the formatting to a certain part which is in the code tag. Any help is appreciated.

Link to comment
https://forums.phpfreaks.com/topic/131199-solved-code-tags/#findComment-681314
Share on other sites

U grab stuff between the

 & 

tags (preg_match)

apply the hightlighting

apply codes that wont interfere with the bbcode/smilie parser

reinsert this block back into the message

 

the message can be stored in its bbcoded state.

 

for special codes ya can look here Special HTML Codes

 

by replacing the '[' with the special code, ya avoid the bbcode parser alltogether, than it comes to any smilies that may be in the code.

 

 

Link to comment
https://forums.phpfreaks.com/topic/131199-solved-code-tags/#findComment-681393
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.