emehrkay Posted July 18, 2007 Share Posted July 18, 2007 i am using a wysiwyg text editor to input text to a db that flash displays. flash sucks. anyway, flash doesnt like blockqoutes and perfers textformat with an attribute of blockindent. flash still sucks i want to go from <blockquote><blockquote><blockquote>text</blockquote></blockquote></blockquote> to <textformat blockindent="34">text</textformat> where 3 blockquotes = 34, 2 or 1 = 20 flash sucks and i have no idea where to start. thanks for your help Quote Link to comment Share on other sites More sharing options...
effigy Posted July 18, 2007 Share Posted July 18, 2007 It sounds like berating Flash is just as important as getting help.... Try this: <pre> <?php $str = <<<STR <b>Test</b> <blockquote>one</blockquote> <blockquote><blockquote><i>two</i></blockquote></blockquote> <blockquote><blockquote><blockquote>three</blockquote></blockquote></blockquote> <blockquote><blockquote><blockquote><blockquote>four</blockquote></blockquote></blockquote></blockquote> STR; $blockindent = array(20, 20, 34); function my_print_r($array) { foreach ($array as $key => &$value) { $value = htmlspecialchars($value); } print_r($array); } $pieces = preg_split('#(?:<blockquote>)+(.*?)(?!</blockquote>)#', $str, -1 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); my_print_r($pieces); foreach ($pieces as &$piece) { if (strpos($piece, '</blockquote>') == FALSE) { continue; } $piece = preg_replace('#</blockquote>#', '', $piece, -1, $blockquotes); if ($indent = $blockindent[$blockquotes-1]) { $piece = '<textformat blockindent="' . $indent . '">' . $piece . '</textformat>'; } else { echo "Error: No blockindent exists for $blockquotes blockquotes.<br>"; } } my_print_r($pieces); ?> </pre> Quote Link to comment Share on other sites More sharing options...
emehrkay Posted July 18, 2007 Author Share Posted July 18, 2007 thank you, ill try it out soon. i wish i didnt have to do this 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.