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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:37:18+00:00 2026-06-03T11:37:18+00:00

Background: I’m having some trouble understanding exactly how to best use controllers in an

  • 0

Background:

I’m having some trouble understanding exactly how to best use controllers in an MVC architecture.

I have a webapp that follows this URL scheme:

  • / – main index
  • /static-page – static pages
  • /categories – index for specific categories
  • /categories/users – index for users of specific categories
  • /categories/users/id#/user-name – specific user for specific categories
  • /categories/event-type-A index for events related to specific categories
  • /categories/event-type-A/id#/event-name – specific event for specific categories
  • /categories/event-type-B index for events related to specific categories
  • /categories/event-type-B/id#/event-name – specific event for specific categories

*Note: This URL structure is similar to StackOverflow’s in that malformed URL’s (wrong event-names) are automatically corrected if the id# exists.

Question:

Since categories, users, and event-types each have unique functionality associated with them (i.e. editing users, manipulating events, etc.), they are all contollers of their own (right?). And since event-type-A and event-type-B are very similar, they share common functionality extended from an events class.

How do you suggest that I organize my controllers such that they follow “standard practice” in OOP and MVC design?

I currently have a Pages class for my static pages, and I was expecting to have a categories class that calls a users class, event-type-A and event-type-B classes that (as described above) are extensions of an events class… but from here I’m unsure of how best to proceed.

Any simple/pseudo code examples would be greatly appreciated.

Additional Information:

FYI: I am using PHP/MySQL. I have been trying to learn MVC by writing my own framework, but have recently switched over to CodeIgniter. That being said, either a CodeIgniter specific solution or a general MVC solution will suffice.

Update:

As Ako mentioned below, I could definitely have the events combined into a single controller and then have the two types spawn from that. I am just confused as to how I actually set up each of the controllers (which methods to define, etc.) to make them work together properly.

  • 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-03T11:37:22+00:00Added an answer on June 3, 2026 at 11:37 am

    It looks like this answer offers a solution that is satisfactory.

    In essence:

    Use HMVC to load necessary MVC triads when desired.

    I had never heard of HMVC before, but apparently it will allow me to designate when certain MVC triads are called which will ultimately give me control over when different Controllers are called. This will allow each of the sections (categories, events, types, etc.) to act as independent modules that have their own index pages that can be called, but can also offer the ability to serve much more elaborate data as needed.

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

Sidebar

Related Questions

Background I have a pair of functions I want to use to animate some
Background I have a service that is connecting to Microsoft CRM 2011, and updating
Background: I have a css and a js that is used only by the
Background We have an asp.net 4.0 web application written in C# that calls a
Background: I have to create a report that will be run regularly to send
Background I have a basic HTML page with an iframe that points to a
Background: I have some existing apps in the App Store and I have just
Background I have a CakePHP application that lives in /m/ . I want to
Background: Sometimes when editing in vim it is possible to have extra characters in
Background We currently use OpenID for authentication of users, and use the Claimed Identity

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.