Jump to content

Do I use a MVC framework for dynamic sites or apps?


smudgie

Recommended Posts

I'm confused! I'm reading up on the MVC approach. I've created a SPA using this approach but don't really understand what I'm doing as it was using a basic tutorial. I'm pretty sure what I produced was client-side for asynchronous updating using AJAX and JSON! So this would be the JavaScript Front end approach where frameworks like Angularjs and Backbone.js are used right???

 

However, when I read up about this it's all about using the SPA approach for a mobile application which I visualise for mobile app development rather than the web. If then I want to produce a website with DB interrogation, should I be looking at PHP MVC approaches that are server side and use frameworks like Codeigniter and Cakephp?

 

Can someone please try and explain 'simply' which approach is the better for creating dynamic web content? I'm aware that there isn't a one size fits all approach but i need a starting point. Thanks

MVC is just a design pattern. If you want to use this pattern along with a single page app then you want to seperate the client from the server side completely. You want to look at using a RESTful approach to getting your data. So your server side can be any kind of framework ( or bespoke ) such as zend / symfony / laravel. The Model part of the server side will hold all of the business logic ( communicating with the db etc), the Controller will take the rest request -> speak to the model -> return the models data to the view, and in your case this would be in a JSON response. So technically no view.

 

heres a good tutorial for doing it using laravel and backbone:

 

http://net.tutsplus.com/tutorials/javascript-ajax/combining-laravel-4-and-backbone/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.