0

I'm trying to include file from another php framework but doing so it's giving me an error failing open the stream for the files which are included inside the file I'm trying to include.

Any idea on how to include it properly so that the files included inside my included file are able to be processed?

enter image description here

Grasper
  • 1,293
  • 12
  • 26

2 Answers2

0

Your include only looks only one directory up.

include ("../../other/index.php");

would be two directories up so into the "admin" directory then the "other" directory

This has been asked before here

Community
  • 1
  • 1
Zach
  • 1,964
  • 2
  • 17
  • 28
  • Those includes would also have to be relative to the directory you are including index.php from. It's kind of a pain, I know – Zach Mar 09 '15 at 18:17
  • relative towards the first file? – Grasper Mar 09 '15 at 18:19
  • Yes, once you include the index file any includes inside of that file are treated as though they are in the same directory that you included it from. So in this case once it is included in file.tpl it is just like the index.php is in the view directory. – Zach Mar 09 '15 at 18:22
  • You don't have to move the folder, the includes from the index file are just treated as though the file is in the view folder so the include paths in the index file need to be updated as though it were in the view folder – Zach Mar 09 '15 at 22:48
0

What Framework are you using?

I have little experience with templates but I don't think you should be adding PHP code to a template file.

Click Here for another question on how to add PHP code to a template file.

However as far as your path goes, try using:

include("../../other/index.php");
Community
  • 1
  • 1
dishrex
  • 543
  • 3
  • 9
  • Ah I have not heard of VMC. However, I do not believe what Zach said is incorrect. The includes in index.php do not need to be relative to the file.tpl directory, but they do need to be relative to index.php. At least this has been the case in my testing. If you just open index.php do the other files include correctly? – dishrex Mar 09 '15 at 18:42
  • I meant mvc framework, model view controller. No, they don't include correctly – Grasper Mar 09 '15 at 18:45
  • Oh. If you put a test.php file in the other directory and include it using include("test.php") does that include correctly? Because if the files you are trying to include in the index.php are not including correctly then it is either a problem with the include path or permissions. – dishrex Mar 09 '15 at 18:54