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

  • Home
  • SEARCH
  • 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 8813191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:47:02+00:00 2026-06-14T03:47:02+00:00

So I wrote my PHP MVC framework, and have Dispatcher class that can instantiate

  • 0

So I wrote my PHP MVC framework, and have Dispatcher class that can instantiate appropriate Controller class and call defined method passing arguments.

Now inside Dispatcher I check if this Controller exists and if method exists, what should I do if controller or method does not exist?

At the moment I just return HTTP Object that prints 404 – Page not found.
But there is no way for me to customize this message from inside application, and I want to provide users a way to customize 404 messages without editing dispatcher.

Is a good way to go to always have Error controller that would get instantiated when there is a error, and that would load lets say Error404.html view file?
So users would be able to customize this view file to fit their application design.

Is there any other way to achive this? And what would be the best way to return error from dispatcher, and let “users” or developers that are working on that MVC to easily customize 404 and other messages?

Thanks!

  • 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-14T03:47:04+00:00Added an answer on June 14, 2026 at 3:47 am

    I would propose you have an error controller that takes in an error code (number or string) as an argument. This allows you to gracefully handle various kinds of errors and be able to provide a stack trace if necessary. You can even utilize this work for 500 errors.

    My answer comes with the assumption that a controller can return various actions and each action can have it’s own template.

    Symfony also seems to handle errors in a similar fashion. They have a separate module and action for each error.

    sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_m‌​odule'), sfConfig::get('sf_error_404_action'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is a General Question about MVC .. I wrote a PHP Class that
I wrote my own little PHP MVC Framework, and now Im exploring caching strategies
So I have a PHP stack that looks roughly like this Class Stack {
i wrote some php code that can change any width=any number with the string
I am developing a php MVC framework from scratch and have run into an
I have planned to write my own light weight MVC for PHP, that will
I'm trying to write a simple PHP MVC framework to play with. Right now,
I wrote a PHP script that retrieves values from a MySQL Query. I used
I wrote a PHP CUrl Class, if i execute Methods which should return the
I wrote a php script that must be run on the php interpreter (Without

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.