note 56643 deleted from function.include by aidan
| From: | aidan@php.net | Date: | Sat, 15 Apr 2006 16:32:25 +0000 |
| Subject: | note 56643 deleted from function.include by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-108156@lists.php.net to get a copy of this message | ||
Note Submitter: phpguy at excludme dot mailstop dot yogelements dot com
----
On navvywavvy's not of 27-Aug-2005 02:53:
re: include'd/require'd function/method
does not see class property's/variable's
I just ran into this and after reading your solution-less description of the problem I decided to
simply try passing the properties I needed to the included method by reference and it works just
fine. I also tried passing the whole class space via $this and that works fine too.
Note that i was also include()ing and referencing the included method FROM a method, in fact the
constructor in this case.
example class code:
<?php
class myclass {
var $samplevar;
function myclass() {
this->sample="value":
include('sampleinclude.incl');
samplemethod($this->samplevar);
}
}
?>
example sampleinclude.incl
<?
function samplemethod(&$samplevar) {
echo $samplevar;
}
?>
displays: value
I also tried to include/require sampleinclude.incl from classes globalspace ie outside of any
method, thinking that I could then use $this->samplemethod() but it wouldn't let me.