Welcome Guest, Not a member yet? Register   Sign In
Passing empty $variables to viewer
#1

[eluser]überfuzz[/eluser]
(I guess that this subject has been posted before, but I couldn't find any threads.)

Lets say that theres a clock on a site. It puts out time and a short message during the morning, the eventing and during the day noting.

Example 1
0625 - Go back to sleep!

Example 2
1350

Example 3
2132 - Way passed bed time!

The method I'm using now is passing an empty $message = ""; to the view-file. That would be example 2, above. However I don't really like to pass empty variables here and there... How do I work this in a mvc-structure?
#2

[eluser]kgill[/eluser]
You've got a couple choices here - the way you're doing it is the easiest, but if you're bothered by setting a var to "", then you need to add some logic in your view to check if the variable is set and act accordingly.
#3

[eluser]überfuzz[/eluser]
[quote author="kgill" date="1251665781"]You've got a couple choices here - the way you're doing it is the easiest, but if you're bothered by setting a var to "", then you need to add some logic in your view to check if the variable is set and act accordingly.[/quote]
Mhmm, right now I'm definitively more bothered by adding logic to the view. I guess it's because I don't wanna mess things up for the designer. Tnx!




Theme © iAndrew 2016 - Forum software by © MyBB