requiring a class... twice
Posted: Wed Feb 01, 2006 10:12 am
I have a function that calls a class inside of it, and I need to run this function twice
my code looks like this
and my readyMessage() function looks like this
If I run the code like this I get the error "Cannot redeclare class"
If I require the class outside of the function I get "call to a member function on a non-object"
my code looks like this
Code: Select all
$message1 = $this->readyMessage($message);
$message2 = $this->readyMessage($prevMessage);Code: Select all
function readyMessage($message){
require 'class/user.common.class.php';
$common = new common;
$message = $common->make_clickable($common->replaceSmilies(stripslashes(nl2br(htmlentities($message,ENT_QUOTES)))));
return $message;
}If I require the class outside of the function I get "call to a member function on a non-object"