Welcome Guest, Not a member yet? Register   Sign In
question on MVC
#4

[eluser]Pygon[/eluser]
Well, I think your issue lies more with what a "library" is, than loading/instantiating objects. It seems to me that instead of instantiating template "libraries" (which I assume is really just a container for template information and may have some functions), you should use it as it is intended -- a library, being a collection of functions that manipulate/return data and data holders.

I would either:

1) Convert your Template class into a Model which creates and manages an array of template objects, including the manipulation of their data. This is more in-line with MVC and the way it should be done.

2) Seperate any logic from your Template class into an actual library, declare the class within the library file (or as an include), and simply load the library once using it to instantiate object. Example:
Code:
$this->load->library('TemplateLib','template');
$tpl1 = $this->template->new_template($user_tpl_id); //Returns a new template object

-- OR --

3) Keep trying to write non-MVC code and stick it into code igniter.


Personally, I would go with number one.


Messages In This Thread
question on MVC - by El Forum - 12-17-2007, 04:22 AM
question on MVC - by El Forum - 12-17-2007, 02:00 PM
question on MVC - by El Forum - 12-18-2007, 01:45 AM
question on MVC - by El Forum - 12-18-2007, 09:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB