phpwiz Posted August 24, 2009 Share Posted August 24, 2009 Ok, i have made a BBcode/emoticon script and i have a "quote" option in it it all works perfectly BUT i want the Quotes to get smaller/smaller everytime someone quotes someone else so it becoames like a quote pyrimid i will show a screenshot of what i kinda want mine to look like. screenshot: i smudged out some of the words. here is the BBcode script: <html> <head> <style type='text/css'> .solid { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; font-family: arial; border-right: 1px solid black; border-bottom: 1px solid black; } .border { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; background: #97B3FF; font-family: arial; border-right: 1px solid black; border-bottom: 1px solid black; } .border1 { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; background: #000000; font-family: verdanda; border-right: 1px solid black; border-bottom: 1px solid black; } </style> </head> </html> <?php function bbcode_format ($str) { $str = htmlentities($str); $simple_search = array( //added line break '/\[br\]/is', '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[align\=(left|center|right)\](.*?)\[\/align\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[mail\=(.*?)\](.*?)\[\/mail\]/is', '/\[mail\](.*?)\[\/mail\]/is', '/\[font\=(.*?)\](.*?)\[\/font\]/is', '/\[size\=(.*?)\](.*?)\[\/size\]/is', '/\[color\=(.*?)\](.*?)\[\/color\]/is', //added textarea for code presentation '/\[codearea\](.*?)\[\/codearea\]/is', //added pre class for code presentation '/\[code\](.*?)\[\/code\]/is', //added paragraph '/\[p\](.*?)\[\/p\]/is', '/\[quote\](.*?)\[\/quote\]/is', //emoticons '/\:smile:/is', '/\:wow:/is', '/\:cool:/is', '/\:bigsmile:/is', '/\:cry:/is', ); $simple_replace = array( //added line break '<br />', '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', // added nofollow to prevent spam '<a href="$1" rel="nofollow" title="$2 - $1">$2</a>', '<a href="$1" rel="nofollow" title="$1">$1</a>', '<div align="$1">$2</div>', //added alt attribute for validation '<img src="$1" alt="" />', '<a href="mailto:$1">$2</a>', '<a href="mailto:$1">$1</a>', '<span style="font-family: $1;">$2</span>', '<span style="font-size: $1;">$2</span>', '<span style="color: $1;">$2</span>', //added textarea for code presentation '<textarea class="code_container" rows="10" cols="60">$1</textarea>', //added pre class for code presentation '<pre class="code">$1</pre>', //added paragraph '<p>$1</p>', '<div class="border"><b>Quote</b><br>$1</div>', //emoticons '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_ssmile.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_ssuprised.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_scool.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_sbiggrin.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_scry.gif">', ); // Do simple BBCode's $str = preg_replace ($simple_search, $simple_replace, $str); // Do <blockquote> BBCode $str = bbcode_quote ($str); return $str; } function bbcode_quote ($str) { //added div and class for quotes $open = '<blockquote><div class="quote">'; $close = '</div></blockquote>'; // How often is the open tag? preg_match_all ('/\[quote\]/i', $str, $matches); $opentags = count($matches['0']); // How often is the close tag? preg_match_all ('/\[\/quote\]/i', $str, $matches); $closetags = count($matches['0']); // Check how many tags have been unclosed // And add the unclosing tag at the end of the message $unclosed = $opentags - $closetags; for ($i = 0; $i < $unclosed; $i++) { $str .= '</div></blockquote>'; } // Do replacement $str = str_replace ('[' . 'quote]', $open, $str); $str = str_replace ('[/' . 'quote]', $close, $str); return $str; } can someone PLEASE help me with this, thankyou --Brian Link to comment https://forums.phpfreaks.com/topic/171682-help-bbcode/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.