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

[eluser]ScottBruin[/eluser]
Hi, I am currently converting a large web app that I wrote to CodeIgniter because I want it to be a) easier to update for myself and b) easier to change in the future by someone less acquainted with PHP and less acquainted with the project. When I leave my job in the spring, I want my successor to be able to change the entire appearance of this web app with very limited knowledge of PHP. Obviously, the MVC approach allows for quite a bit of this.

Ultimately, though, it seems like certain "view"-ish elements need to be contained in the Controller. For example, there are three different search types--searchA,searchB,searchC. Each of these search types uses the SAME view file but different models, search variables, etc. As such, each one has its own method in the same controller. However, they will use the same view pieces. Each search type needs its own title string, subtitle string, and a few other strings farther down in the page. If only the titles were different then each could have its own header. However, this is not the case, because (for example) the search input field needs a specific string based on search type.

So my question is this: can I, and if so, what would be an ideal way to, separate out these strings which seem to fit more into the view aspect of MVC? Perhaps I could create a separate view file which just defined a few basic variables? My initial hesitation with this is that it will not work because of the way I am loading multiple view pieces (method2 - embedding views). The other option is to include these strings in the controller. This seems to be including "view" information in the controller, though.

Thanks for any help. This is more conceptual than technical, so don't be afraid to be abstract.
#2

[eluser]mdavis1982[/eluser]
Hi...

Could you use the language helpers for this? You could set up all your strings in the language files and echo them out in the view files.

Just a thought... I've never used the language classes, but I'm sure they would fit what you need.

Thanks...

Matt
#3

[eluser]wiredesignz[/eluser]
Using HMVC modules may just be what you're after. Wink
http://ellislab.com/forums/viewthread/72123/




Theme © iAndrew 2016 - Forum software by © MyBB