Reputation: 7053
Basically, I started working in a more mvc manner where I have my html, objects, executing code, seperated into views,module, code.
So for example, if I want to create a registration form, I create a folder called "Registration" and put three files:
Registration
--- Views (contains html table and form)
--- Module (contains a class that validates output and inserts the new user).
--- Controller (executes the class in the module file).
My question is the way I work called MVC? Another question how time saving are the existing frameworks in php eg. ruby on rails, zend framework.. I am a bit new to php and I am not sure if it is worth swaping to one of them 1?!?
Upvotes: 1
Views: 96
Reputation: 21466
Not quite, but close.
MVC stands for Model-View-Controller.
Models contain domain logic. They represent pieces of data, and can handle persistence (e.g. storing/fetching data in a database.)
Views contain presentation (and presentation logic). Some people like to separate the two, creating a View Controller that contains the presentation logic and keep the view simple. Regardless, views are where your HTML goes.
Controllers contain application logic. They typically tie together models and views, and should be fairly lightweight. Most of the heavy lifting is done by the model.
As far as frameworks are concerned, do your research. I would not recommend Zend Framework for beginners, but that's just me. Ruby on Rails is not PHP.
Frameworks are nice in that they help "force" you to be organized, but are not a do-all-end-all solution. Sometimes they get in the way, sometimes they make things really easy.
Just to get you started in the a framework mindset, check out CodeIgniter. While I personally have not used it in a long time, it is a good framework for beginners to jump in to. The docs are great and community is decent.
Upvotes: 3
Reputation: 120
The way you work is MVC but i think it would save you a lot of time, switching to a framework that is designed from scratch with MVC in mind. The learning curve is always a bit strange...a bit tough at start but time saving for as long as you will be a developer. If it is a big project i would suggest Symfony2 with Doctrine2.0
Upvotes: 0
Reputation: 513
Try looking into creating your model view and controller through the powershell by typing commands like "zf create controller controller_a" or "zf create project project1" rather than typing out all of that nonsense.
You'll have to configure an environment variable to run the commands in powershell.
I find frameworks very powerful. It's ultimately up to you to decide what you are comfortable with.
Upvotes: 1