How does one correctly address a callback function inside a CodeIgniter library? |
I'm writing my own "bbcode" library around PHP's bbcode PECL extension. In some cases, I need to provide a callback function. As I understand it, within an object one passes callback parameters like this:
'callback' => array($this, 'function_name') So far so good. When I call the code which does this from inside the library, e.g. if I put $this->test() at the end of the constructor, everything works as expected. However, if I try to call this from outside the library, e.g. $this->bbcode->test() from in some controller, I get the following errors: Code: **A PHP Error was encountered** needless to say, the callback does not execute. After bashing my head at this problem for a while, I figured fine, I'll move these callback functions to a helper instead, and that way I can just use their names directly: 'callback' => 'bbcode_function_name' After reorganizing my code in this manner, I now get the following error: Code: **A PHP Error was encountered** The "function number" does not remain constant with each pageload. At this point, I have no idea what to do... (more details about the code posted on StackOverflow here) |
Messages In This Thread |
How does one correctly address a callback function inside a CodeIgniter library? - by ojensen5115 - 02-27-2015, 04:02 PM
|