grahamgr3 Posted June 13, 2015 Share Posted June 13, 2015 In the ecommerce book, in chapter 3, you include files like so: include('./includes/header.html'); doesn't include('includes/header.html') do the same thing? Why use the ./ I don't understand. This wasn't covered in the other book I read from you php and mysql 4th edition. Link to comment Share on other sites More sharing options...
Necuima Posted June 13, 2015 Share Posted June 13, 2015 Hi, In Larry's book, PHP & MySQL for Dynamic Websites, on page 90, he has a good explanation: "As a best practice, use the ./filename syntax when referring to files within the same directory as the parent (including) file, ... A file stored in a directory above the parent file would be included using the path ../filename, and a file stored in a directory below the parent file would use ./directory/filename". You can also go up (../) and then down again if necessary - e.g., ../next_level_up_directory/then_down_from_there_directory/filename. I believe that they are referred to as 'document relative paths'. Hope it helps, Cheers. Link to comment Share on other sites More sharing options...
Larry Posted June 15, 2015 Share Posted June 15, 2015 As far as I know, there's no difference between using ./includes/header.html and includes/header.html, as both refer to the same file. The former explicitly says to start in the current directory whereas the latter implicitly states that. Link to comment Share on other sites More sharing options...
Recommended Posts