Using Drupal paging, sorting and table facility system outside Drupal DB layer
Submitted by ivan on Mon, 10/08/2007 - 19:07.
As mentioned in another article I was writing a module for Drupal. I needed to connect to another DB (MS SQL) and I had my classes and some legacy code I'd like to push into the module.
I chose drupal not only to exploit the cms part but also to use some of its API
So I discovered how to:
- Make GET queries avoiding Drupal form API
- Make paged queries when you can't use the DB layer cos your DB is missing LIMIT
- Use the pager link generator (theme_pager aka theme('pager'...))
- Use the table themer (theme_table aka theme('table'...))
- Use the table sorting facility (tablesort_get_order, tablesort_get_sort substituting tablesort_sql)
- Have a reasonable default sort