Welcome Guest, Not a member yet? Register   Sign In
Formatting database results
#7

[eluser]Madmartigan1[/eluser]
[quote author="n0xie" date="1253375654"]

1. You only loop over the recordset once instead of twice
2. The data doesn't change which makes it easier to reuse (since uc_words is just representation logic it shouldn't be in the model or controller imho)[/quote]

Yes, looping through everything twice and reassigning the array to a new variable does suck, but the idea behind my original post was getting the data formatted before it is sent to the view, in order to use the template parser class. This is particular to my situation perhaps: my boss, who doesn't know anything about php, needs to be able to edit my view files. The cleaner they are, the better. I'm not suggesting that this is best practice.

Quote:I’d like to be able to use the parser class, which requires result_array() for database query results. It would be great if my boss, who knows nothing about php, could edit my view files without screwing them up.

Your second point is right on the money. Sometimes I need to use a htmlentities() formatted value and the raw data at the same time, maybe in a form. A workaround for this with the method I used above (and remember, I'm using the template parser class) is to assign a new key/value pair to the array.

Thanks guys.


Messages In This Thread
Formatting database results - by El Forum - 09-17-2009, 11:32 PM
Formatting database results - by El Forum - 09-18-2009, 01:52 AM
Formatting database results - by El Forum - 09-18-2009, 10:28 AM
Formatting database results - by El Forum - 09-18-2009, 07:43 PM
Formatting database results - by El Forum - 09-19-2009, 12:12 AM
Formatting database results - by El Forum - 09-19-2009, 04:54 AM
Formatting database results - by El Forum - 09-19-2009, 12:30 PM
Formatting database results - by El Forum - 09-19-2009, 02:02 PM
Formatting database results - by El Forum - 09-19-2009, 02:14 PM
Formatting database results - by El Forum - 09-19-2009, 10:16 PM
Formatting database results - by El Forum - 09-29-2009, 02:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB