NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
seems this discussion is more about theory than practice. Let's consider the followin simple example. I suppose you know php quite well so you'll guess what path will be printed.

create a.php in the root directory of the disk C:\ with the following content:
Code:
<?php
include "include/b.php";

create directory "include" in c:\ and create file b.php in it (its full path will be c:\include\b.php) and its content should be like below:
Code:
<?php
  include "include/c.php";

now create one more "include" subdirectory within the "include" just created and file c.php in it (its full will be c:\include\include\c.php) and its content should be like below:
Code:
<?php
  echo __FILE__ . "\n";

and finally create a copy of c.php one level upper (c:\include\c.php)

then try to run a.php with any php engine you have.

then add a function call to a.php before the include:
Code:
<?php
  ini_set("include_path", '!');
  include "include/b.php"


and give it one more try.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 22 May 2004
Posts: 76
Reply with quote
dmitri,

As i stated previously, I am aware of how php acts when including nested files, i.e., chaining includes. The example you provide demonstrates the following, that all files are seen relative to the calling file and it's folder. For example, include/b.php and include/c.php and include/include/c.php are all seen relative to a.php and it's calling folder and not relative to each other.

Try this example using a php engine, call the file include/b.php and see what file it pulls up. It will pull up include/include/c.php and not include/c.php like it does when calling a.php. Now try this same example in phped. It will pull up include/c.php in contradiction to the php engine. Now try this same example and see that dreamweaver pulls up the file the same exact way that the php engine does unlike phped.

See your example proves my point which is that all files are seen relative to their calling file. Of course when I run a.php and it includes include/b.php which then includes include/c.php, I am not seeing include/b.php as another calling file. In fact because of the way php acts, all files ragardless of how nested they are with includes are considered relative to the very first calling file. Which is my point exactly in that phped does not see it as such, except in the case of chained includes. Whereas in both cases, chained includes or a single include, dreamweaver is consistant with php's method but phped is not consistant with php's method.

Again try running just b.php using your php engine and tell me which file it calls. Then run this example in dreamweaver and phped and see which editor more closely emulates the php engine.

Jeff
View user's profileFind all posts by jphilapySend private message


Joined: 22 May 2004
Posts: 76
Reply with quote
hi Dimitri,

Just to clarify my point a little more and make sure there is no confusion: I am talking specifically about the "Open at Cursor" feature. When ever I right click on a require statement and choose "Open file at cursor" I am often finding phped is opening the wrong file. I have done this test in dreamweaver many times and dreamweaver always gets the correct file but phped doesnt. I honestly can't see what chaining includes has to do with opening file at cursor since I have no intention of opening the great great great grandchild of a.php by "Open file at cursor". It is my intent to only get at the immediate file. And as I stated before, dreamweaver does that correctly.

Before I upgraded to phped's latest version and installed on windows vista, I believe that this problem never existed. After the upgrade and vista install, I am findng myself Opening a file at the cursor, editing it, uploading it, then running it in my browser and wondering why the heck my changes are not taking. Well it is simple. Phped is opening the wrong files. If it finds two files with the same name, then open file at cursor wont open the immediate one. Perhaps it will if the the immediate file is listed higher in the alpha numeric order as was demonstrated in one of my examples.

Jeff
View user's profileFind all posts by jphilapySend private message
[resolved] open file at cursor
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 2 of 2  

  
  
 Reply to topic