Welcome Guest, Not a member yet? Register   Sign In
Application design
#1

[eluser]Unknown[/eluser]
I want to use CodeIgniter for future web sites.
My web sites tend to have a lot of common functionality; the ability to add new pages, edit old ones, post news, use a contact form etc.
Occasionally I want to add new features. Maybe a link database or a poll system.

That's why I'd like a module-based approach. And I want all administrative features for controlling the different modules in one place (eg. /admin).

Before discovering CodeIgniter, I was in the process of writing my own little "CMS". I hadn't heard the term "MVC" when I started, but it did something like this:

(Simplified a bit, but illustrates the idea)
Code:
// Syntax:
// $template->assign($part_of_page, $content);
//  ... where $content usually is a call to $module->execute which returns module output

$main_module = $_GET['module'];

// Assign content. First the requested module, and then some extra stuff
$template->assign('content', $module->execute($main_module, 'index');
$template->assign('content', $module->execute('polls', 'showpoll', 45);

// And maybe a block?
$template->assign('right_blocks', $module->execute('articles', 'show_article', 3);

// These assignments could even be defined in a database so that the administrator could control every part of the page rendering.
So every module is like a controller. That's why I initially wondered if CodeIgniter could instantiate multiple controllers.



There are a couple of things I want to ask.

1. Would the module be the controller? Or the models/libraries? Or a combination?
2. What if I want to have a poll in the sidebar of one of my pages? Ie. I have a showpoll() method in my poll controller, and I want that exact output on the side of every page.
3. Comments on my approach above?
4. What about an admin panel? Every controller has an admin version (which is located in controllers/admin?

Actually, I'm not exactly sure what I want to ask. But any input would be great Smile
#2

[eluser]esra[/eluser]
Check the wiki for Modular Separation and find the Modular Separation thread started by Zacharias. If you have questions that can't be answered on that thread, leave me a PM. I'm assuming you want a portal-like file system with modules, blocks (partials in CI/Ruby lingo), templates, etc. A lot of us are using that approach for larger applications or applications that use a lot of common modules.




Theme © iAndrew 2016 - Forum software by © MyBB