emehrkay Posted August 5, 2007 Share Posted August 5, 2007 I am interested in using the MVC approach for my application. I am not interested in using a existing framework, I feel that I'd have a better understanding if I was a part of the creations processes. Anyway, how should I structure my file system? Is there a standard that should be followed, or does it matter as long as youre following an MVC practice? Thanks sorry if this has been asked before, didnt find anything with the search Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted August 5, 2007 Share Posted August 5, 2007 as with most things like this, i think it generally depends on how you like working and/or what you like about what you've already used. for example - i found CodeIgniter easy to learn/use and had a bag of features, but CakePHP was more solid and consistent and did more for you - so when I made my own, I took the best from both of these and made something that i was comfortable working with. so in answer to what you need to have when rolling your own, the question is somewhat easier to answer than "which is the best framework to use?" - simply because you can decide based on what you already know. I'd definitely recommend having a good play with several frameworks/CMS's though - even if it's just a 10 minute mess around to see what first impressions/ease of use is like. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted August 5, 2007 Author Share Posted August 5, 2007 yeah, ill download them and play around with them for a little. I watched the codeignither tutorial on their site a while ago, ill look again. Thanks for the insight. I am currently thinking of something like this www(public pages) -js -css -ssa(server-side actions - ajax) classes(this will contain the meat of the application) I am just not sure how to structure that classes directory. Should I do model and controller directories for each section or have a base model directory and have it contain files for all sections of the application? (i've seen it done both ways) But I will continue looking aorund. Quote Link to comment Share on other sites More sharing options...
Eric_Ryk Posted August 5, 2007 Share Posted August 5, 2007 yeah, ill download them and play around with them for a little. I watched the codeignither tutorial on their site a while ago, ill look again. Thanks for the insight. I am currently thinking of something like this www(public pages) -js -css -ssa(server-side actions - ajax) classes(this will contain the meat of the application) I am just not sure how to structure that classes directory. Should I do model and controller directories for each section or have a base model directory and have it contain files for all sections of the application? (i've seen it done both ways) But I will continue looking aorund. File structure really doesn't matter at all. Do what you are most comfortable using. I prefer separation of directories, so I do mine that way, but you might like to have them in one folder, which you can do. Some things can be stuck in one directory and have an indicator appended to the filename, ie: some.model.php. Just go with what works for you. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted August 5, 2007 Author Share Posted August 5, 2007 Cool good to hear eric. I was asking mainly because I wanted to amke sure that there wasnt a standard. If there were one, I wanted to follow it so that when others are brought into the project, it would be an easy transition. Thanks Quote Link to comment Share on other sites More sharing options...
448191 Posted August 5, 2007 Share Posted August 5, 2007 The location of your classes has absolutely nothing to do with the MVC paradigm. That said, I strongly recommend a PEAR based naming scheme. It is as close to a standard one can come. Quote Link to comment Share on other sites More sharing options...
Buyocat Posted August 5, 2007 Share Posted August 5, 2007 I second that, go with the PEAR naming convention and you will save yourself a lot of trouble down the road managing dependencies and namespace collisions. Quote Link to comment Share on other sites More sharing options...
448191 Posted August 6, 2007 Share Posted August 6, 2007 For convenience (I'm the biggest advocate of convenience you'll ever find): <?php function __autoload($className){ include str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; } ?> It's common practice to lowercase packages and subpackages, but I prefer UpperCamelCase for class names. E.g.: Backbone_Controller_Token Library |___Backbone |____Controller |____Token.php Quote Link to comment Share on other sites More sharing options...
emehrkay Posted August 9, 2007 Author Share Posted August 9, 2007 Thanks guys. I will definitely look at the pear documentation again and make sure that I am following the naming conventions - I think thats the only thing that i really like from the pear project Quote Link to comment 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.