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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:09:18+00:00 2026-05-22T01:09:18+00:00

I’m building a MVC where everything is a module. This will allow me to

  • 0

I’m building a MVC where everything is a module. This will allow me to separate collections of objects like forum and user modules to further organize my MVC.

/blog
    /controller
    /model
    /view
/user
    /controller
    /model
    /view
/forum
    /controller
    /model
    /view

I currently map routes for something like forum/edit/34 to /forum/controller/edit.php which contains the Forum_Controller_Edit class. (This is slightly different from the standard approach where all actions are methods of a controller Forum_Controller::edit()). This allows me to separate all the individual “actions” of a controller into their own files so I don’t have to manage large controllers with 10 different actions.

Anyway, here is the problem. Suppose I want to add new controllers to a module. For example, lets say I want to have forum topics (forum/topic/view/34). I could create a new “topic” module.

/forum
    /controller
    /model
    /view
/topic
    /controller
    /model
    /view

But then 1) I would have to use URL like /topic/view/ instead of forum/topic/view, 2) I would have separated related components (topic should be a part of the forum module), and 3) I would now not be able to create a general “topic” module for something like content nodes if I wanted to.

So how can I build a modular MVC while allowing multiple controllers (with multiple actions) in each module?

Kohana Framework decided to implement a HMVC to solve this problem. However, that results in many is_file() checks to find the correct location of the file you wish to load. I/O checks are very precious on commodity hardware so I don’t consider that an option. Also, it is not apparent which version of a class is being loaded which can lead to confusion when working with multiple classes with the same name.

I would like to find a solution to this problem that does not involve pre-setting paths or checking folders for the right class. Yet, of the last 20 frameworks I looked through they don’t seem to have a good answer to this universal problem. Anyone have some ideas?

Routing Update

If I was to implement routing, how would it work? How would I handle first (/forum), second (/forum/view), and third levels (/forum/topic/view)? How would my routes know the difference between a third level route and a second level route with a parameter? In other words, which of these would my system try to do? (Given the URI “forum/topic/view/34”)

$controller = new \Forum\Controller\Topic\View;
$controller->action('34');

// or
$controller = new \Forum\Controller\Topic;
$controller->view('34');

// or
$controller = new \Forum\Controller;
$controller->topic('view', '34')

Routing Update 2

Taking Kyles advice I decided that ALL controllers will need a route set which will allow me to define which of the classes above the URL path “forum/topic/view/34” routes too. After all, EVERY URL is important and should not be based on the filesystem structure you have in place. I believe he is right in saying that the URL design deserves more attention than we often give it.

  • 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-22T01:09:19+00:00Added an answer on May 22, 2026 at 1:09 am

    I would like to find a solution to
    this problem that does not involve
    pre-setting paths

    It’s called routing, and that is the solution.

    of the last 20 frameworks I looked
    through they don’t seem to have a good
    answer to this universal problem

    The universal solution is routing.

    That is precisely why frameworks employ it. Routing is the way to retain your architecture while still having flexibility with your URIs. Otherwise, your URI naming would always have to conform to your MVC layout.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.