My comments ...
Yes you can filter the results with the filters... easily.
GETTING THE DATAS :
Since I have been coding with Joomla, I have not been using native
mysql_fetch_assocwhile($row = mysql_fetch_assoc($result)) {
Does it means that the rows are called with a call at once ?
I mean how do it behav regarding the memory ?
The alternative I show you is using a PHP array storing all the requested rows, before to output. It can be heavy in memory for HUGE lists.
So I don't know with
mysql_fetch_assoc, maybe it is better.
WRITE IN MODEL
You have all the tools to get an object list handling filters, pagination, acls, accesses, publish states, authoring, ...
It is called a model
Instead of puttin all added source in the helper, try to find the right place.
The right place is in the list model.
And if you want to apply theses features for all models, put this code in classes/jmodel.item.php, the superclass.
Eventually, in the prepareQuery() of the model to export datas, add a new context query. Spoken a lot of the forum. It is the only one function called for all SQL select queries.
If you want to export the current layout grid, you do not need to create a new SQL profile. Eventualy, switch the state var to avoid the pagination.
Again, all you need to know in Cook :
- prepareQuery() and profiles in it
- States vars
You can do want you want. That's almost it !
SYNTAX :
Long list of arguments is not very clean and problematic when you want to set up only the 9th var for example. An array of params, like JDom can do the job to switch the behaviors (download, overwrite, headers).
I think you can also pass theses arguments trough the states vars, because you are (now) in the model.
RENDERING THE OUTPUT :
Respecting the standards, you should put you file header and all what is relative to output in the VIEW. Even if it is not hml. It can be a RSS feed, it can be a file to download...all the outputs in the view.
I am wrong too in cook, because the indirect file access is written in a class, I found this more pluggable, independent. So, as you see, what is the best ?
Having a quite short and independant function in the model, without returning to the view is good also. Debate.