davej Posted March 18, 2012 Share Posted March 18, 2012 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 More sharing options...
Man In Tan Posted March 19, 2012 Share Posted March 19, 2012 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 More sharing options...
davej Posted March 19, 2012 Author Share Posted March 19, 2012 MVC is "preferred architecture" that everyone tells you to use. I would have to admit that I don't yet have a complete grasp of what all it entails. I also don't know if it applies equally to all forms of server-side scripting. See... http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Link to comment Share on other sites More sharing options...
Ingolme Posted March 19, 2012 Share Posted March 19, 2012 It's a programming paradigm. Not necessarily related to server-scripting at all, but to programming in general. Link to comment Share on other sites More sharing options...
davej Posted March 19, 2012 Author Share Posted March 19, 2012 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 More sharing options...
birbal Posted March 19, 2012 Share Posted March 19, 2012 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 More sharing options...
jimfog Posted March 22, 2012 Share Posted March 22, 2012 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 More sharing options...
davej Posted March 22, 2012 Author Share Posted March 22, 2012 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 More sharing options...
jimfog Posted March 23, 2012 Share Posted March 23, 2012 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.