By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,047 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,047 IT Pros & Developers. It's quick & easy.

object probleme

P: n/a
I've created an instance of a class
$smarty = new smarty();
then I create an other instance of an other class and sending the
$smarty instance to that class
$user = new user($smarty);
This is the user class

class user {
var $smarty
function user($smartyInstance){
$smarty = $smartyInstance;
// but when I do
$smarty->method("some parameters");
// it doesn't work
// how fix it ?
}
}

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

On 16-Oct-2003, Geiregat Jonas <en***@sdf-eu.org> wrote:
I've created an instance of a class
$smarty = new smarty();
then I create an other instance of an other class and sending the
$smarty instance to that class
$user = new user($smarty);
This is the user class

class user {
var $smarty
function user($smartyInstance){
$smarty = $smartyInstance;
// but when I do
$smarty->method("some parameters");
// it doesn't work
// how fix it ?
}
}


$smarty is local to the function named user. If you want to refer to the
class variable you need to use $this->smarty like:

class user {
var $smarty;
function user($smartyInstance){
$this->smarty = $smartyInstance;
$this->smarty->method("some parameters");
}
}


--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.