Re: accessing variables within objects
- From: mrclay <steve@xxxxxxxxxx>
- Date: Thu, 31 Jul 2008 11:05:11 -0700 (PDT)
Notice: Undefined property: FastTemplate::$main in
/whereever/inc.template.php on line 293
The basis of a lot of PHP template classes is that you can access
arbitrary properties on an instance after setting them.
$obj = new stdClass();
$obj->foo = 'bar';
echo $obj->foo; // defined, no notice
Whereas:
$obj = new stdClass();
echo $obj->foo; // accessing undefined property
If your template class needs to support the latter, you could try
this:
class MyTemplate extends FastTemplate {
public function __get($name)
{
return null;
}
}
Steve
.
- References:
- accessing variables within objects
- From: Marten Lehmann
- accessing variables within objects
- Prev by Date: Re: [PHP] PHP email
- Next by Date: RE: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd!
- Previous by thread: Re: [PHP] accessing variables within objects
- Next by thread: Re: [PHP] Php CLI Parser not working
- Index(es):