Create one single controller.php or have multiple like "login.php" for example -


i pretty new world of php mvc, apologize obvious answer.

when comes controller, should create multiple individual files "login.php" , "logout.php" , have login form action point "controller/login.php"?

form action="controller/login.php" method="post"

or

form action="controller/controller.php" method="post"

in case second correct one, should include or extend "login.php" (assuming should still exist in different file) controller.php?

i wondering if design perspective correct. have read: should extend controller or create helper? single controller multiple views ,which seem similar (with different language though), still not sure got it.

thanks in advance,

controllers not single action. controllers represent group of actions specific module. instance, user controller have typical crud actions, , maybe login/logout action, , possibly register(under create maybe) or forgot password action. if making blog, post/entry controller have typical crud actions , maybe comment action. 1 controller per module or per model even.

all controllers should extend similar base, doesn't have same entire project.

your forms like: action="controllername/actionname" or action="controller.php?q=controllername/actionname depending on how have mod-rewrite setup.

as far views, each controller action potentially have multiple views (depending on post or data), pretty standard each action have single view.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -