Welcome Guest, Not a member yet? Register   Sign In
What is best structure for a big application?
#12

[eluser]Rick Jolly[/eluser]
[quote author="Edemilson Lima" date="1200614138"]...but what I really want (I guess) was a way to load controllers within views or load constructors instead. We could have something like:

Code:
$this->load->constructor('[folder/]file','function'[,$data][,true/false]);

Such method could load the file and execute the function, passing the optional $data array and print or return the output to the caller constructor or view. Loaded constructors could also load another views or constructors.

Well, I don't know the impact of this or even if it is possible, but I think it could solve this issue.[/quote]

CI can only run one controller per request, but you can accomplish something similar in the view. You can call a helper function in the view that loads a specified library and calls the correct method of that library. The library would return a view with it's data as a string and the helper would echo that. Search for HMVC in these forums.

Also, I don't think anyone has mentioned extending the CI controller. You could put all your common code in the constructor of a parent controller that extends the CI controller. Then instead of extending the CI controller, you'd extend your custom parent controller. There are lots of examples in these forums.


Messages In This Thread
What is best structure for a big application? - by El Forum - 01-14-2008, 07:09 AM
What is best structure for a big application? - by El Forum - 01-14-2008, 07:24 AM
What is best structure for a big application? - by El Forum - 01-14-2008, 09:45 AM
What is best structure for a big application? - by El Forum - 01-17-2008, 12:43 AM
What is best structure for a big application? - by El Forum - 01-17-2008, 06:33 AM
What is best structure for a big application? - by El Forum - 01-17-2008, 06:34 AM
What is best structure for a big application? - by El Forum - 01-17-2008, 07:06 AM
What is best structure for a big application? - by El Forum - 01-17-2008, 11:55 AM
What is best structure for a big application? - by El Forum - 01-17-2008, 02:14 PM
What is best structure for a big application? - by El Forum - 01-17-2008, 02:15 PM
What is best structure for a big application? - by El Forum - 01-17-2008, 03:20 PM
What is best structure for a big application? - by El Forum - 01-17-2008, 03:27 PM
What is best structure for a big application? - by El Forum - 01-17-2008, 06:55 PM
What is best structure for a big application? - by El Forum - 01-17-2008, 07:14 PM
What is best structure for a big application? - by El Forum - 01-19-2008, 08:20 PM
What is best structure for a big application? - by El Forum - 01-20-2008, 10:40 AM
What is best structure for a big application? - by El Forum - 01-21-2008, 11:19 AM
What is best structure for a big application? - by El Forum - 02-02-2008, 01:35 PM
What is best structure for a big application? - by El Forum - 02-02-2008, 03:53 PM
What is best structure for a big application? - by El Forum - 02-02-2008, 05:15 PM
What is best structure for a big application? - by El Forum - 02-02-2008, 05:51 PM
What is best structure for a big application? - by El Forum - 02-03-2008, 06:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB