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 8975911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:59:49+00:00 2026-06-15T18:59:49+00:00

Everyone understands mvc as he wills, but sometimes I do not, at all. Currently

  • 0

Everyone understands mvc as he wills, but sometimes I do not, at all.
Currently the majority of my controllers look like this:

<?php
$input = $_REQUEST['field']
$model = new Model();
$status = $model->launchSpaceShuttle($input);

switch($status)
{
    case Model::STATUS_LAUNCHED:
        header('Location: Mars');
        break;

    case Model::STATUS_INVALID_INPUT:
        echo "Please press the big red button correctly";
        break;

    case Model::STATUS_PILOT_IN_HANGOVER:
        ...
        ...
    case etc.
}

This leads to the obvious question:
Is this how it’s supposed to be? Model’s returning status codes and controllers deciding how to display and what?
Because this very much conflicts with the theory about simple, short controllers that act as a really thin wrapper between the input device and the model.

bonus case: what about ajax requests if I’m too lazy to create a view ;

  • 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-06-15T18:59:51+00:00Added an answer on June 15, 2026 at 6:59 pm

    Ah, that’s easy. Just move the entire switch to a view file.
    It’s the view’s responsibility to interact back with the user.

    Redirecting from inside the view is just as fine.
    Anyway in most frameworks the view file inherits the $this variable which represents the active controller.

    Same regarding ajax requests.

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

Sidebar

Related Questions

I’m aware that not everyone uses a thorough architecture when developing an MVC application
So here I got this little program which everyone obviously understands. include <iostream> include
everyone. This is a piece of code from using sqlite in android tutorial: return
everyone. Please see example below. I'd like to supply a string to 'schedule_action' method
everyone! new to here and been pondering about this myself for some times with
I'm switching to RoR from ASP.NET MVC. Yeah, migrations are cool, but I do
Just to make sure everyone understands what I am asking for, I will run
Hello Everyone, I am developing an app which have to show all the restaurants
I have an Access report that I would like to output like this :
I understand that there may be other questions regarding vanity urls but everyone i

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.