Welcome Guest, Not a member yet? Register   Sign In
MVC question (view-controller relationship)
#8

[eluser]BrianDHall[/eluser]
Directly to the thread topic, MVC methodology does not forbid use of logic in the view - infact, that's why CodeIgniter supports both it's own template engine and pure PHP code inside Views, even ensuring that $this in views refers to the codeigniter object itself.

So using "if logged in display this, if not display this" is acceptable. An option is to just use an if/then include when you are loading your views, so "if logged in load this view, if not load this one"...but personally on my login menu sometimes I have three or four options depending on the permissions of the person logged in, but I only need this in one view file in one part of the entire program and its just for convenience navigation.

It would just be a bigger hassle for me, I find, to go into MY_Controller for special view logic, or doing alternate view files just for getting a minor piece of navigation working.

Its good to know how to avoid it though, just incase it does become a big deal, or at some point you are required to use views differently. Just one more tool to put in the tool bag...but you don't have to use it if its overkill. Sometimes the flathead screwdriver fits the phillips-head hole Smile


Messages In This Thread
MVC question (view-controller relationship) - by El Forum - 09-07-2009, 08:00 PM
MVC question (view-controller relationship) - by El Forum - 09-07-2009, 08:13 PM
MVC question (view-controller relationship) - by El Forum - 09-08-2009, 01:57 AM
MVC question (view-controller relationship) - by El Forum - 09-08-2009, 02:22 AM
MVC question (view-controller relationship) - by El Forum - 09-08-2009, 03:30 AM
MVC question (view-controller relationship) - by El Forum - 09-09-2009, 04:05 AM
MVC question (view-controller relationship) - by El Forum - 09-09-2009, 05:15 AM
MVC question (view-controller relationship) - by El Forum - 09-09-2009, 08:52 AM
MVC question (view-controller relationship) - by El Forum - 09-09-2009, 06:03 PM
MVC question (view-controller relationship) - by El Forum - 09-09-2009, 08:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB