Jump to content

MVC?


davej

Recommended Posts

I haven't gotten too far yet learning PHP, and the current beginner project I'm working on is a php page that submits a form to itself. It has one other php include page just for defining php functions. When the PHP is working it will have Javascript/AJAX added. Is that a completely "goofball" situation or is it usable? It certainly isn't MVC, so what is it? Thanks

Link to comment
Share on other sites

Submitting the form to itself is fine, depending on the situation. If you submit it to itself, and the user didn't fully fill it out (or filled it out incorrectly), you can use a few echo()s to prevent the user from having to fill the whole form out again. In my opinion, PHP functions should ALWAYS be in a separate file to be include()d at run time. It makes it a lot easier to reuse those functions in other projects, or even just other pages of the same project. "MVC" is not in my vocabulary, and Google isn't helping. What is "MVC"?

Link to comment
Share on other sites

It's a programming paradigm. Not necessarily related to server-scripting at all, but to programming in general.
There is code which generates the visible pages. There is code which validates user input. There is code that processes user input probably accessing files and databases and using object classes and methods. There is code which spews the results back to visible pages. Does that cover the M, the V, and the C?
Link to comment
Share on other sites

There is code which validates user input. There is code that processes user input probably accessing files and databases and using object classes and methods. There is code which spews the results back to visible pages
http://www.tonymarst...controller.html
Link to comment
Share on other sites

Nonetheless, PHP, basically, it is not an MVC architecture language(though you can develop PHP applications based on MVC)-it is a "template view language",meaning, no controllers in the loop, but only view and models.

Link to comment
Share on other sites

Nonetheless, PHP, basically, it is not an MVC architecture language(though you can develop PHP applications based on MVC)-it is a "template view language",meaning, no controllers in the loop, but only view and models.
So what constitutes a true "controller?"
Link to comment
Share on other sites

It's code the does a specific "job"-(it acts as the mediator between "views" and "models")i have never made an application based on MVC so i cannot giveyou an example-my knowledge is purely theoretical.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...