convinceme Posted October 11, 2007 Share Posted October 11, 2007 i needed some help with ['quote'] system Currently I am using following code to replace the tags $string = str_replace("[Quote]", "<table bgcolor=#000000><tr><td>",$string); $string = str_replace("[/Quote]", "</font></td></tr></table>",$string); The problem with this is that in case there is no at the end, the <table> wont end which means it would distort the whole page. Is there a way to ensure that is there in the $string or if its not than just close the table where the string ends. using explode to check if the word exists in the string could be one possible option maybe havent tried it though it think should work.. is there any other? Quote Link to comment Share on other sites More sharing options...
SharkBait Posted October 11, 2007 Share Posted October 11, 2007 I personally wouldnt use tables. Tables are for TABULAR data. This is what i use for quotes something similar anyway: <?php function doQuotes($str) { $code = array("#\[quote\](.*?)\[/quote\]#is"); $html = array("<div class\"quote\"<span>Quote:</span>\n\\1</div>"); $str = preg_replace($code, $html, $str); return $str; } ?> So i use regular expressions to find and within a str and then replace them with the <div></div> tags that are CSS formatted etc. Quote Link to comment Share on other sites More sharing options...
prime Posted October 11, 2007 Share Posted October 11, 2007 css if good, hell it's great. but there are still a few places that tables are better for layout. granted most of these css design flaws are being ironed out in css3 but there's also still some browser problems as well with css support from i.e as there prob will always be. Microsoft have out and out said they don't care about the acid test or standards, that it's not their primary goal. Personally I'd like to see I.E go don the drain Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.