I think using a View for this is overkill, unless the data was
accessed through means other than the page/program that is displaying
this formatting (ie. there are multiple applications accessing the
database).

Depending on how complicated you want your formatting, why not store
each formatting data as a "template" in a table somewhere.

Can use Dwoo (http://www.dwoo.org), and in PHP parse the string as
DwooTemplate string. Obviously, you can use any template engine - Dwoo
was just an example.

Alternatively, can just store it as PHP code and eval().

Or for simple formatting, just store it as a sprintf() formatting
string, and pass the arguments in a set order (you can use argument
swapping if the display you want has them in a different order).




On Nov 14, 11:56 am, "Aaron Cooper" <[EMAIL PROTECTED]> wrote:
> Howdy folks,
>
> I have a bit of a weird one, and it's more to do with design than coding of 
> any sort.
>
> To keep things simple:
>
> We have a MySQL table called display_type. This table is used to store config 
> data for a range of physical devices that do certain jobs. This table holds 
> Min Value, Max Value, Default Value, Unit.
>
> The data stored in this table can pertain to many devices that work with 
> different sets of variables. E.G. It could be a media player, where Min, Max 
> and Default Vals are volume settings. It could be a thermometer where Min, 
> Max and Default are temperature ranges for display purposes only.
>
> Because there is such a wide range of formats for this table, each with a 
> different way of displaying these values to the user, we also want to store a 
> display format for each record to use in printf or number_format functions in 
> the code. Not too different to how you format numbers in Excel.
>
> The table in question is more of a lookup table with a finite data 
> collection, although it will be added to as time goes by. It is maintained by 
> us, and us alone (no user input will reach it)
>
> All  the values (Min, Max, Default and Current) are stored MySQL's decimal 
> format with 6 decimal places.
>
> Any ideas on the best way of storing formatting (and later using in PHP) 
> masks like this?
>
> Oh, and and by the way, the backend is being built on the Zend Framework if 
> anyone is aware of a nifty way one of those libraries can aid in this.
>
> Cheers
> Aaron

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to