4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Creating a list from bbc
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
kakaze
Junior WebHelper
Junior WebHelper


Joined: 05 Aug 2007
Posts: 1
Location: Shanghai, China

PostPosted: Sun Aug 05, 2007 1:22 pm (16 years, 8 months ago) Reply with QuoteBack to Top

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?

________________________________
Image
OfflineView User's ProfileFind all posts by kakazeSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




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.203837 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme