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? Link to comment https://forums.phpfreaks.com/topic/97924-getting-started-with-mvc/ 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 Link to comment https://forums.phpfreaks.com/topic/97924-getting-started-with-mvc/#findComment-501275 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.) Link to comment https://forums.phpfreaks.com/topic/97924-getting-started-with-mvc/#findComment-501286 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. Link to comment https://forums.phpfreaks.com/topic/97924-getting-started-with-mvc/#findComment-501408 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. Link to comment https://forums.phpfreaks.com/topic/97924-getting-started-with-mvc/#findComment-501419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.