Welcome Guest, Not a member yet? Register   Sign In
basic understanding
#1

[eluser]artisa[/eluser]
hi,

recent i had a situation where i was generation a list of data in "view", nothing special.
but then i was wondering how should i show status, like:
1 - open
2 - close
3 - error

Code:
//views/cool_stuff/list.php
...
echo '<td>'.$item->status.'</td>';
...

but, as you may guess status 1,2 and 3 doesn't look cool enough.

so, first thought was to make array, like:
Code:
$super_status = array('1'=>'Open','2'=>'close','3'=>'Error');

and then i got confused, where should i put this array. Some other views might be interested into these status titles as well.

So, whats the best practice?
#2

[eluser]Unknown[/eluser]
be aware about your health
#3

[eluser]artisa[/eluser]
[quote author="frank.william62" date="1302814518"]be aware about your health[/quote]

any useful suggestion?
#4

[eluser]danmontgomery[/eluser]
Config file, language file, in the model, stored in the database... Could put it in several places. If you're storing status as an integer, I would probably store the values in the database, so you could join the status table in your query and not have to worry about converting in the view.
#5

[eluser]artisa[/eluser]
language file seems to the good place. Model file sounds logic too, but how to access to model file from view?




Theme © iAndrew 2016 - Forum software by © MyBB