|
|
Home Manual 11. API Reference mosHTML::sortIcon |
| mosHTML::sortIcon |
|
|
|
|
Last reviewed: Not reviewed mosHTML::sortIconBuilds the HTML code for displaying a standard clickable sort icon. The alternative text for the image is taken from the current language settings. Syntaxstring sortIcon ( string $base_href, string $field [, string $state] )
ExamplesExample: This example (abstracted from the com_statistics component) shows the construction of an array, $sorts, containing the HTML for two sort icons. // get sort field and check against allowable field names $field = strtolower( mosGetParam( $_REQUEST, 'field', '' ) ); if (!in_array( $field, array( 'agent', 'hits' ) )) { $field = ''; } // get field ordering or set the default field to order $order = strtolower( mosGetParam( $_REQUEST, 'order', 'asc' ) ); if ($order != 'asc' && $order != 'desc' && $order != 'none') { $order = 'asc'; } else if ($order == 'none') { $field = 'agent'; $order = 'asc'; } // browser stats $order_by = ''; $sorts = array(); $sort_base = "index2.php?option=$option&task=$task"; switch ($field) { case 'hits': $order_by = "hits $order"; $sorts['agent'] = mosHTML::sortIcon( "$sort_base", "agent" ); $sorts['hits'] = mosHTML::sortIcon( "$sort_base", "hits", $order ); break; case 'agent': default: $order_by = "agent $order"; $sorts['agent'] = mosHTML::sortIcon( "$sort_base", "agent", $order ); $sorts['hits'] = mosHTML::sortIcon( "$sort_base", "hits" ); break; } $database->setQuery( "SELECT * FROM #__stats_agents WHERE type='0' ORDER BY $order_by" ); $browsers = $database->loadObjectList(); Please report any errors on this page to the Developer Documentation Forum. |
|
| Last Updated ( Wednesday, 28 September 2005 ) |
| < Prev | Next > |
|---|





