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
PHP Thumbnail Creation
Ok so i use this function to create thumbnails:
Code: [Select]function createthumb($name,$fil
Namespace Problem
I'm having problem with a section of code with a variable namespace.
This code works fine:
Using real time in php
I'm very average at PHP and im looking to introduce time to something on my site.
Its a sports si
understanding functions and classes
Code: [Select]
class person {
var $name = "Jimmy Goe";
function get_nam
PHP Script runs on CLI but not through web browser
I am running into an issue that I just can't seem to find the answer to. I have a Windows Server 200
Pls help with PHP
Pls can anyone direct me on how to create a user account for a customer. For example i want know if
How to change www in url with a specified name
Hi
I'm trying to change the url http://www.sitename.com/apparels to something like below
http:
PHP page loading in Firefox but not in IE
hello,
i am currently doing a project in PHP and i have a problem. If I view the project in M
Help with PHP Calendar code...
Hello, I'm new to this forum and I'm glad I found it.
I wrote this code for a PHP calendar as an
Confusing Functions
So, I've been reading up on Functions and I like them! However, I need some help using variables in