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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:48:34+00:00 2026-05-18T21:48:34+00:00

I have a pretty reasonable amount of experience in PHP (around ~5 years of

  • 0

I have a pretty reasonable amount of experience in PHP (around ~5 years of experience with some websites made and two browser games). This is the first time I’ve really messed around with a core engine instead of just developing a plugin or module for something like Joomla. I have an extensive amount of experience in other object oriented languages (such as Java).

My question is, I find myself developing the site much like a normal site, but I want it to be more flexible than that and I’m not sure I’m “doing it right”. In a way, I feel like I’m building half a CMS.

For example, I have the main page set up through a controller that controls what views are currently being displayed. The main view page looks like this:

<?php $this->load->view("headerview"); ?>
<?php $this->load->view($contentview); ?>
<?php $this->load->view("footerview"); ?>

in a view file itself (so I can dynamically load the contentview, the others don’t really change). This is my first question, since I do ALL the control through my main control file, is this correct?

My index function sets the mainview as the view to be loaded with variables for the “contentview” and “gameview”. When “contentview” is the game, it has a split pane, one showing the players stats and such, and the other showing whichever page the player is currently on (the merchant shop, in a battle, exploring the world, etc.). What determines what is being shown here is the “gamecontent” variable (also passed in the “main” controller).

<?php $this->load->view("menubar"); ?>
<?php $this->load->view($gamecontent); ?>

In short, all view handling is currently being done in the main controller, i.e. one single controller.

$data['title'] = "Experimental Page";
$data['maincontent'] = "gameview";
if($page == 1) {
    $data['gamecontent'] = "townview";
} else if ($page == 2) {
    $data['gamecontent'] = "merchantview";
} else if ($page == 3) {
    $data['gamecontent'] = "explorationview";
} else if ($page == 4) {
    $data['gamecontent'] = "hospitalview";
} else if ($page == 5) {
    $data['gamecontent'] = "fightview";
} else if ($page == 6) {
    $data['gamecontent'] = "adminview";
}

$this->load->helper(array('form','url'));
$this->load->library('form_validation');
$this->load->view('mainview', $data);

I haven’t started adding the fighting and shopping functions yet, but I can see this controller getting very large, very fast. This seems wrong to me, but somehow I can’t formulate how to properly arrange the core setup.

My goal is to (hopefully) split up the controllers so that each one handles a separate game function, like healing, fighting, exploring and so on, and is separated much like my models are (user, mobs, items, etc.).

Can anyone help me figure out how to properly arrange this project?

  • 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-18T21:48:35+00:00Added an answer on May 18, 2026 at 9:48 pm

    I use the Symfony Event Dispatcher component to do something like this; the component can be installed without using the Symfony Framework, so you can use it with CodeIgniter, but there might already be something similar available to you; I don’t know CodeIgniter.

    The Event Dispatcher is a generic implementation of the Observer Pattern.

    • I have a list of modules which register themselves as observers for any actions which they handle
    • Each request passes through an action (e.g. “townview”)
    • My controller just creates an Event with whatever the action was as the name; the Event Dispatcher system then finds any modules which claim to be able to handle that action and passes over control to them

    This way the main controller doesn’t have to change, no matter how many actions you have; it just creates an event and throws it out through the dispatcher; if it’s not handled it throws a massive error (in DEV) or a nice one (in PROD).

    This is especially useful in our application, where we have lots of optional components that can be switched on or off for different users / clients; no complex logic in the controller at all, I just don’t register the modules if they aren’t enabled for a client.

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

Sidebar

Related Questions

I have pretty simple jquery code : $(document).ready(function(){ $('img.marqFl').on({ mouseenter: function() { $(this).animate({height: 300},
I have pretty good skills in PHP , Mysql and Javascript for a junior
I have built a PHP calendar system and have pretty much everything done but
We've got a reasonable sized C++ application that's pretty old at this stage, so
I'm pretty new to PHP and i'm trying to learn namespacing to a reasonable
It is pretty common, especially in applications with an ORM, to have a two
I've been writing some custom WinForm controls which do a pretty heavy amount of
I have a rather big php script that uses the foreach loop pretty often.
i have pretty simple simple question (i hope so). How do i change the
I have pretty standard Qmail toaster installation. I'm using the dot files to set

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.