CodeIgniter: Where should a particular functionality go ?
Posted
by Samnan
on Stack Overflow
See other posts from Stack Overflow
or by Samnan
Published on 2010-04-16T10:12:41Z
Indexed on
2010/04/16
10:13 UTC
Read the original article
Hit count: 210
I have an application in codeigniter and a page needs to perform the following tasks
1 - controller decides which model to use based of the url and parameters
2 - controller loads the model and get the data from it
3 - controller formats the data in a particular format, depending on the items in it
4 - controller loads a common view, which will display the data (formatted data contains simple display fields)
- now there is a search page, which needs to do a text query against all of the possible text fields in database in all tables. It needs to show each type of data in its own formatted output on a single page as a list.
The problem:
The search controller can do the search, dynamically load model for each record type, and get the data from model. Problem comes when the data needs to be formatted. It looks that ideally the search controller should load another controller which will provide formatted data ... There is where it gets out of control ...
My question is: What am I doing wrong? Is there any better way to do this? How would you do the same to solve the problem?
© Stack Overflow or respective owner