|
Posted by joe t. on 06/11/07 21:56
My apologies, i'm not sure how to ask this question correctly, so i'll
give the examples as i go.
First, i *think* my problem is described here, but i may be
misunderstanding:
http://bugs.php.net/bug.php?id=15233&edit=1
Second, here's my problem:
i have a class defined. Inside that class are several LONG functions
that are called based on the result of a start function:
class doMyWork {
var $dog = "Rex";
var $cat = "Fluffy";
function start ($step2, $FILE) {
# preliminary stuff
require_once("$step2.inc.php"); # Include the external file/
function
$step2($step2); # Call to included external function
} # END start()
# more doMyWork stuff
} # END doMyWork
The value of $step2 originates from a web form based on a user's
selection. Now, the focus is on the require_once(). "step2" is three
things at once: the name of an external file, the name of a function
WITHIN that file, and a string value i need to pass to the function.
In theory, i've included the file with my needed function into my
class, making it a member function of the class, and therefore able to
access properties like $this->cat and $this->dog.
However, this is not the case. An error message tells me i've tried to
use "this" when not in object context. And if i try $this->
$step2($step2), i receive "Call to undefined method doMyWork::
[value_of_step2]".
Can anyone help me out here? i'll clarify as best i can if needed. The
whole point of this is to organize my code, because as i said, these
"step2" functions are very long.
[Back to original message]
|