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
Multi-image upload problems
Lets see if I can get some help on this one. Can anyone show me what I am doing wrong here. I'm just
[function.file]: failed to open stream: No such file or directory
Okay I wrote this little script to upload a csv file that is located on my webhosts server to a mysq
Checking if variable is 0 as opposed to NULL/Empty...
I'm trying to write some code that will retrieve a user's access level from my database and if it do
Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For
Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but h
PHP code needed to get/post form fields and request mysql query results.
I'm new to PHP
I've created an html form to allow the user to request a basic telephone dire
set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli
Give me all your tricks for minimizing jar file size
Hi, I'm coming close to releasing my J2ME game... I am kicking up against the 64k size barrier w
ctype() validation - allowing illegal characters
Hello,
I use ctype() to filter and validate a user form. However, I am trying to allow certain c
Need help in log in and log out?
hi there all of u. i have recently created a site for someone. i have placed log in and log out and