stuffradio Posted March 26, 2008 Share Posted March 26, 2008 I'd like to start using the MVC pattern and try to understand it fully. I do understand the concept... but I'm trying to grasp how I would put that down in code. I want to make my framework modular, so this is an idea on how I'm going to lay it out. Folders = -- Files = - -- config - config for the system -- docs -doc files -- images -- image stuff here -- modules -- module name - module files -- pages - page1.php - page2.php - index.php etc. Do you have any ideas on how I should start working out the bare bones of the structure? Quote Link to comment Share on other sites More sharing options...
dbo Posted March 26, 2008 Share Posted March 26, 2008 I started on the same endeavor this week. In fact, I already mentioned throwing up the code for another guy on the forums. Right now it's about as bare bones as it gets. The core is functional, but I do have a couple more things I want to add before I call it complete. Anyway, here's how I went about it: base - this is the base system that includes my code Libraries - class files used to build the base Loader.php - invokes the system and stores objects in a cache so that 1 instance can be shared Router.php - responsible for sending and receiving requests between model, view, controller Template.php - class used for generating the views (templates) and caching URI.php - class used for parsing/storing the URI requests that come in cache - cached files generated by the view get stored here ext - this is the extension of the base... actual user contributed code goes here Controllers - this is where controllers go Models - this is where models go Views - this is where views go I've got a few more files laying around, but the above is what does the majority of the work. Like I said, I've got a few more things I want to do (mainly documentation) then I'll throw up the code and you're welcome to do whatever you want with it. I'll then wait eagerly for comments... and of course criticism on how I've developed things Quote Link to comment Share on other sites More sharing options...
puritania Posted March 26, 2008 Share Posted March 26, 2008 Just have a quick look at the php frameworks with mvc support. (Zend, Flow3, etc.) Quote Link to comment Share on other sites More sharing options...
stuffradio Posted March 26, 2008 Author Share Posted March 26, 2008 Which design pattern do you guys like the best? The Factory, Observer, and Chain of Command patterns look the best. Quote Link to comment Share on other sites More sharing options...
trq Posted March 26, 2008 Share Posted March 26, 2008 Which design pattern do you guys like the best? The Factory, Observer, and Chain of Command patterns look the best. One would think they all have there place. 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.