Once the ordering functionality has been enabled, you can determine the
current page order from within run()
using
the getSortOrder()
.
You can then use the returned value to determine how to order your data. The following demonstrates how you might do this in SQL.
Example 6.2. Determining the order direction using it in an SQL query
<?php class Driver_containers_rule_weather_controller extends Module_Containers_Driver_Abstract { // ... public function run(Module_Pages_ClientRenderer_PageRequestTree $pageRequestTree) { $db = Application::GetDb(); $select = $db->select(); /* build the select */ switch ($this->getSortOrder($pageRequestTree)) { case 'title': $select->order('title'); break; case 'titled': default: $select->order('title desc'); } /* perform query and use data */ } // ... } ?>