Start
Programowanie
API
mosHTML::sortIcon



mosHTML::sortIcon |
![]() |
![]() |
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. Składniastring sortIcon ( string $base_href, string $field [, string $state] )
PrzykładyPrzykład: 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. |
|
Zmieniony ( 05.02.2006. ) |
« poprzedni artykuł | następny artykuł » |
---|