BB_Code error
Posted on
16th Feb 2014 07:03 pm by
admin
I'm having a problem with a custom built function and keep getting this error:
Warning: Missing argument 1 for BB_Code::BB_Code(), called in /home/cra10002/public_html/mooglebook/input.php on line 21 and defined in /home/cra10002/public_html/mooglebook/function.php on line 4
Fatal error: Call to undefined method BB_Code::parse() in /home/cra10002/public_html/mooglebook/input.php on line 22
the fuction code is this:
Code: <?php
function BB_Code($text) {
$text = " " . $text;
if (! (strpos($text, "[") && strpos($text, "]")) ) {
return $text;
}
else {
$text = preg_replace("/\[b\](.+?)[/b]/is",'<b>1</b>', $text);
$text = preg_replace("/\[i\](.+?)[/i]/is",'<i>1</i>', $text);
$text = preg_replace("/\[u\](.+?)[/u]/is",'<u>1</u>', $text);
$text = preg_replace("/[s](.+?)[/s]/is",'<s>1</s>', $text);
$text = preg_replace("/\[sub\](.+?)[/sub]/is",'<sub>1</sub>', $text);
$text = preg_replace("/\[sup\](.+?)[/sup]/is",'<sup>1</sup>', $text);
$text = preg_replace("/\[tt\](.+?)[/tt]/is",'<tt>1</tt>', $text);
$text = eregi_replace("\[img]([^\[]*)\[/img\]","<img src="\1">",$text);
$text = eregi_replace("\[size([^\[]*)\]([^\[]*)\[/size\]","<font size="\1px">\2</font>",$text);
$text = eregi_replace("\[font([^\[]*)\]([^\[]*)\[/font\]","<font face="\1">\2</font>",$text);
$text = eregi_replace("\[color=([^\[]*)\]([^\[]*)\[/color\]","<font color="\1">\2</font>",$text);
$text = eregi_replace("\[align=([^\[]*)\]([^\[]*)\[/align\]","<div align="\1">\2</div>",$text);
$text = eregi_replace("\[email=([^\[]*)\]([^\[]*)\[/email\]","<a href="mailto:="\1">\2</a>",$text);
$text = eregi_replace("\[email=([^\[]*)\]([^\[]*)\[/email\]","<a href="\1">\2</a>",$text);
return $text;
}
}
?>
and this is the part of the other code thats causing the problem, this script works fine before this line was posted and an attmpt to make bb code to html tag.
Code: $parse_text = BB_Code($comment);
If anyone can help me around this problem I would be greatful
Thank you
No comments posted yet
Your Answer:
Login to answer
151
28
Other forums
asp authentication problem
Hello all,
I want to use the asp authentication (from asp.net configuration) in my web site. there
How to form a xml form table with a single sql statement..?
Hi everyone,
I don't know if this is going to be a duplicate thread but i couldn't
Uploading Filetypes and placing them in seperate folders.
Hello,
first post , and asking for help im afraid. Very new to PHP, was making good progress
PHP MySQL and DATE
Hi everyone
I have a databse and in one of the columns I have date values such as 2009-March-
Is there a function ... auto send IP
Is there some function that can be sent to a ddns service that returns the ip address of a ddns forw
PHP Blog help
Need help with posting comments in a word press blog? I have a comments page where the comments are
I have a parse error in this query help..
Code: $query1="INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES
Include ("Absolute Path") of a file?
I'm not sure what I'm doing wrong. I am writing my php code in the same directory of the file that
check if value exists
I have googled this for a while and I am getting lots of different results. Is there a standard meth
CHECK A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a