|
Author |
Message |
kakaze
Junior WebHelper
Joined: 05 Aug 2007
Posts: 1
Location: Shanghai, China
|
Posted:
Sun Aug 05, 2007 1:22 pm (16 years, 8 months ago) |
|
Ok, I have this function for changing bbcode into html:
Code: | <?
function bbcode($string){
$find = array(
'/\[ol\](.*?)\[\/ol\]/is',
'/\[ul\](.*?)\[\/ul\]/is',
'/\[li\](.*?)\[\/li\]/is'
);
$replace = array(
'<ol>$1</ol>',
'<ul>$1</ul>',
'<li>$1</li>'
);
$output = preg_replace($find, $replace, $string);
$output = nl2br($output);
return $output;
}
?> |
This works great if there are no line breaks between the [ol] & [/ol] tags.
What I'd like better is to be able to have a list between the [ol] and [/ol] tags:
Code: | [ol]one
two
three[/ol] |
and have it change to:
Code: | <ol>
<li>one</li>
<li>two</li>
<li>three</li>
</ol> |
witout having to use the [li] [/li] tags and without any br tags in the output list.
Any suggestions? |
________________________________
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.184416 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |