Toshiba23 Posted March 2, 2007 Share Posted March 2, 2007 Ok, all forums have this... a quote within a quote... simple right? Just put this... [quote]This is a quote [quote]this another quote... inside the first one [/quote] [/quote] This is a quote this another quote... inside the first one I can make my script do 1 quote... but another one inside of it is beyond me... some help? Heres my script: preg_match_all('#\[quote=(.*?)\](.*?)\[/quote\]#s', $text, $matches); foreach($matches as $key => $val){ $author = $usr->user2link($matches[1][$key]); $quoted = "<table width=\"95%\" align=center cellpadding=2 cellspacing=0 border=0 style=\"border: #000000 1px solid;\">\n"; $quoted .= "<tr>\n"; $quoted .= "<td class=\"row1\">Quoting $author</td>\n"; $quoted .= "</tr><tr>\n"; $quoted .= "<td class=\"row3\">".$matches[2][$key]."</td></tr></table>\n"; $text = str_replace($matches[0][$key], $quoted, $text); } Link to comment https://forums.phpfreaks.com/topic/40791-quote-within-a-quote-bbcode-script/ Share on other sites More sharing options...
Nameless12 Posted March 2, 2007 Share Posted March 2, 2007 <?php str_replace(arrray('[quote]', '[/quote]'), array('<div class="quote">', ''</div>', $text); ?> the above is a simple example but you can place <divs> inside <divs> so if you replace with div it will work the same way html works. Link to comment https://forums.phpfreaks.com/topic/40791-quote-within-a-quote-bbcode-script/#findComment-197499 Share on other sites More sharing options...
True`Logic Posted March 2, 2007 Share Posted March 2, 2007 you may also want to use htmlenteties() to stop tags such as </td> from messign with the layout of the actual page Link to comment https://forums.phpfreaks.com/topic/40791-quote-within-a-quote-bbcode-script/#findComment-197509 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.