Page 1 of 1
File Structure
Posted: Mon Jul 18, 2011 8:50 pm
by DomC
Would it be possible for someone to explain Jacek's file structure and also feel free to tell us your own if you have a different one.
Thanks in advance!
Dom
Re: File Structure
Posted: Mon Jul 18, 2011 10:53 pm
by jacek
What do you want explaining exactly ? I do it in pretty much every video don't I
Re: File Structure
Posted: Mon Jul 18, 2011 11:18 pm
by DomC
Yep, but I don't really understand what you out in your core folder and what you put in the initial folder.
I don't really get the difference if that make sense - I hope that makes sense!
Dom
Re: File Structure
Posted: Tue Jul 19, 2011 12:09 am
by jacek
Okay, well. the "core" folder contains all of the code that makes up the backend of the system. So this is generally just a lot of include files. In there core folder, there is init.inc.php which is included by all pages which are in the root, this init file just does things that need to be done on all of the pages (session_start() for example) it also includes all of the files in the "inc" folder. The files in this folder provide functions that are specific to the site (in the blog tutorial there was a file for dealing with posts).
That is basically what I say in the videos, and I think where you are confused is you don't get why the file in the "inc" folder don't just go in the "core" folder directly. The reason for that is that in the core folder there will sometimes be a config.inc.php file and a lib folder, this is generally for bigger projects. The lib folder will contain files similar to the ones in the inc folder except that they are not specific to the site, so there could be a file that does a mysql thing or escapes a string according to if magic_quotes is on or not. And the config file just holds any settings for the site that the site admin may want to change in the future, the database connection info is a common example of this.
It makes a bit more sense to have all these folders for a larger project really, but I wanted to use it for everything to demonstrate a bit of consistency, plus it is the structure I actually use when developing.
Re: File Structure
Posted: Tue Jul 19, 2011 7:43 am
by DomC
Ah, thanks I understand now! And I think you where right about me being confused by the Inc folder in the core folder, but now I understand that their would be other folders as well and everything is clear.
Thanks again
Re: File Structure
Posted: Wed Jul 20, 2011 6:10 pm
by Linkjuice57
Aha, I always wondered that myself also. I personally just throw everything in an /inc/ folder