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 Like 28 Dislike
Previous forums Next forums
Other forums

Variable passed to each() is not an array or object
Hi,

This is a email a friend type of form, and it isn't working anymore.

<?

Simple MySQL query...
Hello,
How could I do a mysql query that does this: SELECT * WHERE date/time < 5minutes ag

check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.

The method delivers er_changed_data.

Redirecting Admin
In my members table, I have a field called "perm" and it's set to zero for all members. Ho

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

Impact of movement type 412 E on MAP
Hi

Usage of movement type 412 E is causing huge change in MAP .

Is there any r

button help
i originally had this but realised it is much easier to have a button.

Code: <?php

for loop without same $i digits?
Hi,

Can some guru please advise how can I accomplish this with a simple for loop ?

I

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

PHP Form to Variable.
Hi! I have written a HTML-form code in DreamWeaver CS3 (in a PHP doc) and I really need it to work s

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash