ohdang888 Posted December 25, 2007 Share Posted December 25, 2007 i new to php i use <?php include("../include/file.php")?> but i can;t figure out the path if i am in in the root directory.... i use... <?php include("/include/file.php")?> but it won't work.... (the folder "include "is located in the same folder as this page.) Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/ Share on other sites More sharing options...
Gamic Posted December 25, 2007 Share Posted December 25, 2007 I think (but am not entirely sure, so please correct me if I'm wrong ) that you'd want to do something similar to: <?php include('./path/to/file.php');//not so sure on this one include('path/to/file.php'); ?> Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423037 Share on other sites More sharing options...
revraz Posted December 25, 2007 Share Posted December 25, 2007 Remove the leading / but i can;t figure out the path if i am in in the root directory.... i use... <?php include("/include/file.php")?> but it won't work.... (the folder "include "is located in the same folder as this page.) Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423039 Share on other sites More sharing options...
Daniel0 Posted December 25, 2007 Share Posted December 25, 2007 but i can;t figure out the path if i am in in the root directory.... You will 99.99999% not have your files in the root directory. Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423094 Share on other sites More sharing options...
ohdang888 Posted December 26, 2007 Author Share Posted December 26, 2007 this code is on my index.php of the root directory <?php include("inlcude/topmenu.php")?> and the path to the file is mysite/include/topmenu.php what am i doing wrong? Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423131 Share on other sites More sharing options...
drummer101 Posted December 26, 2007 Share Posted December 26, 2007 <?php include("inlcude/topmenu.php")[b];[/b] ?> You forgot the semicolon Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423132 Share on other sites More sharing options...
teng84 Posted December 26, 2007 Share Posted December 26, 2007 <?php include("inlcude/topmenu.php")[b];[/b] ?> You forgot the semicolon even if there is no semi colon or terminator it will work because that is the first and the last statement ... Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423137 Share on other sites More sharing options...
drummer101 Posted December 26, 2007 Share Posted December 26, 2007 <?php include("inlcude/topmenu.php")[b];[/b] ?> You forgot the semicolon even if there is no semi colon or terminator it will work because that is the first and the last statement ... Okay I didn't know that In that case Ohdang888 what errors are you getting? Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423141 Share on other sites More sharing options...
ohdang888 Posted December 26, 2007 Author Share Posted December 26, 2007 nvm i solved it myself. it was a misspelling inlcude was suposed to be include i'm an idiot.lol. Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423144 Share on other sites More sharing options...
P3t3r Posted December 26, 2007 Share Posted December 26, 2007 i use... <?php include("/include/file.php")?> but it won't work.... (the folder "include "is located in the same folder as this page.) Try: <?php include("include/file.php");?> So without the leading /, and don't forget the ; in the end either. Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423146 Share on other sites More sharing options...
revraz Posted December 26, 2007 Share Posted December 26, 2007 As stated before, you don't need a ending ; if its the last line of code before the ?> i use... <?php include("/include/file.php")?> but it won't work.... (the folder "include "is located in the same folder as this page.) Try: <?php include("include/file.php");?> So without the leading /, and don't forget the ; in the end either. Link to comment https://forums.phpfreaks.com/topic/83167-solved-php-includes/#findComment-423428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.