Jump to content

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

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.