In the view page in MVC what is the preferred way of handling empty variables
When using the MVC design pattern, I usually try to keep the files as simple as possible.
So in my view, I try not to have a lot of code like this:
if page title exists
display page title
else
display 'default page title'
end if
Instead, in my controller, I could 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 solve this problem?
0
a source to share