ilikephp Posted April 21, 2008 Share Posted April 21, 2008 Hello I have a problem and I think it is very easy to be solved!! In my index.php I have footer.php 1. when index.php and footer.php are in the same folder, everything is OK 2. when index.php is inside the root folder and footer.php is inside the folder PHP_Files I put in index.php: include "PHP_Files/footer.php"; also everything is fine, but the big problem is: when index.php is inside the folder fathers for example and footer.php is inside the folder PHP_Files I receive this error: Warning: include(PHP_Files/footer.php) [function.include]: failed to open stream: No such file or directory in C:\www\arabic\SubPage\Fathers\index.php on line 27 Warning: include() [function.include]: Failed opening 'PHP_Files/footer.php' for inclusion (include_path='.;C:\php5\pear') in C:\www\arabic\SubPage\Fathers\index.php on line 27 The problem is that include can not be identified if the footer.php is not in the same line in folders, it is backward, and index.php is inside a folder... Can U help plzz!!! Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/ Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 include ('../PHP_Files/footer,php'); There you go. =) Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523047 Share on other sites More sharing options...
ilikephp Posted April 21, 2008 Author Share Posted April 21, 2008 I still have the same error :S btw: what is the difference plz between: ('../PHP_Files/footer.php'); and ".../PHP_Files/footer.php"; Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523057 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 You shouldn't have that error. .. means the parent directory (SubPage in this case), and then the relative path is right there. Print out the error again for me, AFTER you put in ../PHP_Files/footer.php in the include. Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523061 Share on other sites More sharing options...
ilikephp Posted April 21, 2008 Author Share Posted April 21, 2008 This is what I put in index.php: include ('arabic/SubPage/PHP_Files/footer.php'); the index.php that I heve a problem in it is my subdomain coz I have another index.php that is before the folder arabic. Warning: include(arabic/SubPage/PHP_Files/footer.php) [function.include]: failed to open stream: No such file or directory in C:\www\arabic\SubPage\Fathers\index.php on line 27 Warning: include() [function.include]: Failed opening 'arabic/SubPage/PHP_Files/footer.php' for inclusion (include_path='.;C:\php5\pear') in C:\www\arabic\SubPage\Fathers\index.php on line 27 Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523070 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 This is what I put in index.php: include ('arabic/SubPage/PHP_Files/footer.php'); the index.php that I heve a problem in it is my subdomain coz I have another index.php that is before the folder arabic. Warning: include(arabic/SubPage/PHP_Files/footer.php) [function.include]: failed to open stream: No such file or directory in C:\www\arabic\SubPage\Fathers\index.php on line 27 Warning: include() [function.include]: Failed opening 'arabic/SubPage/PHP_Files/footer.php' for inclusion (include_path='.;C:\php5\pear') in C:\www\arabic\SubPage\Fathers\index.php on line 27 Put EXACTLY what I wrote. O_O include ('../PHP_Files/footer.php'); That line will work, just copy and paste it in. =/ Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523072 Share on other sites More sharing options...
ilikephp Posted April 21, 2008 Author Share Posted April 21, 2008 :D THXXX a lot!!! it workssss what are the ".." that I put before /PHP_Files? I tried also: include "../PHP_Files/footer.php"; and also it works is it the same? Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523082 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 Yeah, the parentheses don't matter on include because it's a language construct I think. Anyway, the .. references the folder above it. So .. in this case means that the stuff after the .. is in SubPage. =) Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523084 Share on other sites More sharing options...
Wolphie Posted April 21, 2008 Share Posted April 21, 2008 DarkWater: include(), include_once() etc.. are PHP statements, not functions. (Not a language construct) but, yes they do not require the parentheses. Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523097 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 DarkWater: include(), include_once() etc.. are PHP statements, not functions. (Not a language construct) but, yes they do not require the parentheses. I know they're not functions, and they ARE language constructs. Language constructs are different from functions. include() Go down to RIGHT above the comments: Note: Because this is a language construct and not a function, it cannot be called using variable functions Quote Link to comment https://forums.phpfreaks.com/topic/102188-solved-include-indexphp-i-think-its-easy/#findComment-523099 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.