Welcome Guest, Not a member yet? Register   Sign In
Using modules or variable controllers
#1

[eluser]Hyra[/eluser]
Hey there,

I recently installed CodeIgniter hoping it would replace my own MVC framework. So far it's pretty nice and straightforward. I did miss Smarty, but that was easily integrated. So far so good! Smile

But here's my question:

I am running a site that, at places, is build out of different "components". Depending on the user and his settings, certain modules get loaded and presented.

For example. A user can have a little box with a few thumbnails on his personal profile page.

In my own version i check if this is the case, and if so fire up an extra controller from the folder "modules", which, after all the magic, returns the data which i can use within smarty.

Current way:

Code:
// Check DB for custom components to load

// Loop through the dataset and load them up, pseudo like so:
$RandomThumbs = new ThumbCollection(& $this);
$RandomThumbs->setBlah .. etc.

$this->setVars(array("Thumbs" => $RandomThumbs));

Now, how would this be accomplished within a CI environment. Do I want to put all these little "components" into the system/plugins folder and fire them up when needed? Or should I rather place them in the applications library folder, as most of them use the models of the regular places.

In short maybe: What is the best practice to use custom/variable components within the controllers while avoiding a "Matchbox setup".

Cheers for any useful pointers!




Theme © iAndrew 2016 - Forum software by © MyBB