Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6890845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:20:01+00:00 2026-05-27T06:20:01+00:00

My question is simple but (I guess) hard to answer: Do I really need

  • 0

My question is simple but (I guess) hard to answer:

Do I really need a complete Model-View-Controller design pattern in my PHP Website / Web-App?

I can’t understand how a Controller could be useful with PHP since every PHP site is generated dynamically on every request. So after a site is generated by PHP, there is no way to let the View (the generated HTML site in the Browser) interact with the controller, since the Controller is on the server side and generated once for each site request, even if the request is AJAX…

Do I understand something completely wrong?

Why should I use any kind of MVC PHP Framework like Zend or Symphony?

EDIT:
For example lets assume, there should be a website to represent a list of customers in a table:

My Model would be a simple Class Customer on the server side that queries the database.
My View would be the generated HTML code that displays the Model (list of Customers).
And the controller? Is the controller only evaluating the GET or POST to call the correct method of the model?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:20:02+00:00Added an answer on May 27, 2026 at 6:20 am

    Short Answer

    Yes. A controller will be responsible for preparing data to display for rendering and sometimes handle GET and POST requests that originating from your client. It should leave HTML generation to the view.

    Long Answer

    MVC can be very helpful in keeping applications maintainable and your code base sane. The pattern helps ensure separation of concerns of your code and in most cases will steer yor clear of ‘spaghetti php’ where your application logic is tangled with the HTML generation. A sample MVC setup below (there are sure to be many variations of this, but it gives you the idea):

    Model

    Responsible for fetching data from the database and saving changes when requested. One example might be a php object that represents a user with name and email fields.

    Controller

    Responsible for massaging and manipulating data and preparing it for display. The prepared data is passed to a view for rendering, with the view only needing to be aware of just the data it needs to render. For example: a controller may look at a query string to determine what item to fetch to render and combine this with several additional model queries to get additional data.

    Often controllers will also be responsible for handling GET and POST requests that originate from your HTML client and applying some sort of manipulation back on your database. For example – handling form submits or AJAX requests for additional data.

    View

    The view is responsible for actually generating the HTML for display. In PHP, a view would often be a template file with minimal logic. For example, it might know how to loop over items provided to it from the controller or have some basic conditionals.

    Application MVC vs PHP/Python/etc. MVC

    From your other comments it sounds like you are familiar with using MVC in the context of a desktop or mobile application.

    One of the main differences between MVC in the two is the granularity at which the controller is manipulating the view and responding to events.

    For example, in a traditional application the controller might listen for click events originating from a button and respond appropriately.

    When your doing server side html generation however, your controller is only ‘alive’ for a brief moment while its preparing html to ship out over the wire. This means that it can only do so much to setup and prepare the view for display.

    Instead of listening traditional events from the UI, it can instead react in different ways to future GET and POST requests. For example, you may have a "save" button on a form trigger a POST request to your server (such as yourpage.php?action=save&value=blah). While handling this request your controller might access your models and apply changes, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

simple question really (can hazard a guess but just need to make sure), Just
A fairly simple question for which I have a guess, but I can't find
Simple question but i need it :) $query = SELECT * FROM `set` WHERE
Simple question but cannot find answer anywhere. When using a MS Chart Control of
Simple question I guess, but I've spent an hour trying to get a base
I've got a really simple rails question here but I can't seem to find
Really simple question but rather than asking for an academic explanation I want to
My question is very similar this but I guess I need to take it
Pretty simple question (probably) but I guess since im new to python im not
This question can be very simple but could not find the answer; I receive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.