I currently use CodeIgniter as my framework of choice when using PHP. One of the things I am wrestling with is the idea of a "page", and how to represent that properly within MVC. To my knowledge, CodeIgniter has a front controller that delegates to page controllers. In my thought process, each page would have it's own controller. All too often though I see someone using a page controller stuffed with many methods. So in that sense, each action becomes it's own page.
I've never really liked the idea of stuffing many methods into one controller, because it seems like there will be too much overhead if you only need one method or two in the controller at a time. It's seems more reasonable for each page to have it's own controller, and the actions would only correspond to something you can do on that particular page. Am I thinking about this the wrong way?
What makes it more confusing is I'll notice in some web applications where they will have one controller that will have multiple methods (i.e. login, register, view, edit, etc.), but then on others they actually have a login controller, and a register controller. What is the proper use of a "page controller"?
Actually, there is no concept of page in MVC. So this is not page life cycle but request life cycle.There are seven main steps that happen when you make a request to an Asp.net MVC web applications. 1. Routing Asp.net Routing is the first step in MVC request cycle.
Here, we will learn about how to create master page concept in vue.js. Master page concept is also known as theme setup. Its like setting up the pages for layout like sidebar, header, etc. which are common in entire application.
Earlier in the ASP.NET Web Form there is a concept called master page, so that everything that is common for the website you can put into the master page, or in some cases you can create a Custom User Control for Header, Footer and Left Menu.
Download this simple CSS HTML theme and learn how to design MVC project using this template. Step 1. Start a New Empty MVC 5 Project. Go to File New Project. Select Web in Left side and then Select ASP.NET Web Application as your project. Give the name of your project MVC_Design and click OK.
From a domain perspective I definitely say it makes more sense to have 1 controller per domain context. Not necessarily one per page although depending on the context this may be the case. What I mean by context is "actions that are closely related".
For instance an account controller should handle the login, register, logout, change password, actions. They all live within the context of an "Account"
Take Stackoverflow for example. I would have a "Questions" controller which would have actions like DisplayQuestion, AskQuestion, Delete Question, MostRecent Questions, etc. They are all different "Views/pages" that are managed by one controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With