KingOfHeart Posted April 12, 2011 Share Posted April 12, 2011 I made a little codebox by using a . Only problem is when I insert a code and need a tab, it does not create any. Now I could just create a [tab] function but it would make long codes very annoying to add in. Inside this codebox I'll be using tags so I can colorize certain words, otherwise I'd just use a pre tag. So how can I get tabs to show up as tabs but only inside of this code box. function bbcode2html($message) { $bbcode = array( "'\[center\](.*?)\[/center\]'is" => "<center>\\1</center>", "'\[left\](.*?)\[/left\]'is" => "<div style='text-align: left;'>\\1</div>", "'\[right\](.*?)\[/right\]'is" => "<div style='text-align: right;'>\\1</div>", "'\[pre\](.*?)\[/pre\]'is" => "<pre>\\1</pre>", "'\[b\](.*?)\[/b\]'is" => "<b>\\1</b>", "'\[quote\](.*?)\[/quote\]'is" => "<div class='top'><b>Quote:</b><hr>\\1</div>", "'\[i\](.*?)\[/i\]'is" => "<i>\\1</i>", "'\[u\](.*?)\[/u\]'is" => "<u>\\1</u>", "'\[s\](.*?)\[/s\]'is" => "<del>\\1</del>", "'\[url\](.*?)\[/url\]'is" => "<a href='\\1' target='_BLANK'>\\1</a>", "'\[url=(.*?)\](.*?)\[/url\]'is" => "<a href=\"\\1\" target=\"_BLANK\">\\2</a>", "'\[img\](.*?)\[/img\]'is" => "<img border=\"0\" src=\"\\1\">", "'\[img=(.*?)\]'" => "<img border=\"0\" src=\"\\1\">", "'\[email\](.*?)\[/email\]'is" => "<a href='mailto: \\1'>\\1</a>", "'\[size=(.*?)\](.*?)\[/size\]'is" => "<span style='font-size: \\1;'>\\2</span>", "'\[font=(.*?)\](.*?)\[/font\]'is" => "<span style='font-family: \\1;'>\\2</span>", "'\[color=(.*?)\](.*?)\[/color\]'is" => "<span style='color: \\1;'>\\2</span>", "'\n'is" => "<br>", "'\[list=o(.*?)\](.*?)\[/list\]'is" => "<ol>\\2</ol>", "'\[list=u(.*?)\](.*?)\[/list\]'is" => "<ul>\\2</ol>", "'\[li\](.*?)\[/li\]'is" => "<li>\\1</li>", "'\[code\](.*?)\[/code\]'is" => "<div class='code'>\\1</div>", ); $message = preg_replace(array_keys($bbcode), array_values($bbcode), $message); return $message; } Link to comment https://forums.phpfreaks.com/topic/233547-creating-tabs-in-codebox/ Share on other sites More sharing options...
requinix Posted April 12, 2011 Share Posted April 12, 2011 tags allow HTML inside. Go ahead and use it instead of a . Link to comment https://forums.phpfreaks.com/topic/233547-creating-tabs-in-codebox/#findComment-1200891 Share on other sites More sharing options...
KingOfHeart Posted April 13, 2011 Author Share Posted April 13, 2011 If I did that how can I use tags, also it makes a scroll box. http://openzelda.thegaminguniverse.org/tutorials.php?name=&type=0&order=0&dir=0&id=3 Link to comment https://forums.phpfreaks.com/topic/233547-creating-tabs-in-codebox/#findComment-1200902 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.