tutorial on how to make the bb-code insert editor?
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
tutorial on how to make the bb-code insert editor?
Hi guys,
Uhm i am trying to learn how you guys created this application for me to use the "[b]""[b]" when posting this topic. What do you call it and html editor? or html processor?
anyone no where i can get a tut on it?
Kendall
Uhm i am trying to learn how you guys created this application for me to use the "[b]""[b]" when posting this topic. What do you call it and html editor? or html processor?
anyone no where i can get a tut on it?
Kendall
phpbb
i believe it is all part of the phpbb system that you can get from http://www.phpbb.com/
so you can get the code, rip it apart and do what you like with it.
Other wise i think it has to do with regex and the like.
not having seen the code I don't know.
so you can get the code, rip it apart and do what you like with it.
Other wise i think it has to do with regex and the like.
not having seen the code I don't know.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
if you don't feel like ripping it from phpbb, you can also use the pear package..
some sample code: http://home.mysth.be/~timvw/programming ... syform.zip
some sample code: http://home.mysth.be/~timvw/programming ... syform.zip
example code I use:
simple rpeg replca like good ole feyd said. You can use text or find the actual smile n replace.
Code: Select all
<?php
function smile($string) {
$ex[] = '/:\)(?!\))/';
$img[] = '<img src=faces/smile.gif>';
$ex[] = '/:\((?!\()/';
$img[] = '\\1<img src=faces/sad.gif>';
$ex[] = '/:mad:/';
$img[] = '<img src=faces/mad.gif>';
foreach($ex as $key => $value) {
$string = preg_replace($value, $img[$key], $string);
}
?>I just dotim wrote:Code: Select all
<?php function smile($string) { $ex[] = '/:\)(?!\))/'; $img[] = '<img src=faces/smile.gif>'; $ex[] = '/:\((?!\()/'; $img[] = '\\1<img src=faces/sad.gif>'; $ex[] = '/:mad:/'; $img[] = '<img src=faces/mad.gif>'; foreach($ex as $key => $value) { $string = preg_replace($value, $img[$key], $string); } ?>
Code: Select all
<?php
$ex[] = '/:\((?!\()/';
$img[] = '\\1<img src=faces/sad.gif>';
$ex[] = '/:mad:/';
$img[] = '<img src=faces/mad.gif>';
$string = preg_replace($ex, $img, $string);
?>- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Uhm sorry guys i think youre missing my question....you see the form that we use to post messages....? i was wondering how they were able to allo wme to do "[b]" if i wanted to get the text to output bold. i have taken a look at the form and i am figuring it oout...thanks for the help. However i dont know why the cursor is not being repositioned after adding "[b]bold[/b]" to the textarea
Kendall
Kendall
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK