NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Autocomplete & Magic Functions


Joined: 11 May 2006
Posts: 20
Reply with quote
Hi,

I'm using the magic functions of PHP 5.1 in my object model to load dynamically objects and variables (__get, __set). As this does not work together with the PHPEd Code COmpletion system, I am searching for a work around to tell PHPEd, which variable contains which class, e.g.:

$XF=xf::instance();

with

class XF(){
....
$this->lib = new xf_lib();
...
}

class xf_lib(){
...
__get($var){
$this->$var=new xf_$var();
}
...
}

When I now try to activate code completion on:
$XF->lib->testclass

PHPEd can't find the needed definitions of the class as it doesn't recognize that $XF->lib is an object of the class xf_textclass. Now I tried an additonal code block like:

$XF=new xf();
$XF->lib = new xf_lib();
$XF->lib->testclass=new xf_testclass();

But this doesn't work either. Any ideas how I could tell PHPEd which variable contains what class? Especially as all variables are always of the same class type e.g. ..->testclass is always xf_testclass.

Dan
View user's profileFind all posts by blueendSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
Quote:
$this->$var=new xf_$var();

With these "dynamics" freely used, no codecomplation engines will work. With provided example above would you youself guess the class name without running the script?

Quote:
Now I tried an additonal code block like:

$XF=new xf();
$XF->lib = new xf_lib();
$XF->lib->testclass=new xf_testclass();

But this doesn't work either.


You're pretty wrong with this statement Smile
See the images below:




View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 11 May 2006
Posts: 20
Reply with quote
Sorry, I didn't got the point of your "image example" Smile Is it somehow possible to "help" phped in this case to know the correct class?
View user's profileFind all posts by blueendSend private message
Veteran

Joined: 24 Jan 2006
Posts: 311
Reply with quote
Hi there, the example on this image simply shows that PhpED code completion works fine with instances of the class - that was the point. However, if this kind of settings still don't work in your environment, please feel free to post additional info and possibly the whole script with class definitions and their instances and references to class members.
Thank you very much!
View user's profileFind all posts by yfaktorSend private message
Autocomplete & Magic Functions
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic