views:

58

answers:

1

When using the MVC design pattern I usually try to make my view files as simple as possible.

Therefore in my View I try not to have lots of code like this:

if page title exists

    display page title

else 

    display 'default page title'

end if

Instead, in my Controller I might use code like this:

if no page title is specified

    page title = 'default page title'

end if

load the view (pass page title as a parameter)

Is this the best way to tackle this issue?

+1  A: 

Keeping this if-else condition in the controller level is a better idea than moving into views. (if you can otherwise it's alright)

It will make your views look good !!!!

Ish Kumar