function paginator_ul($records, $limit = null, $page_symbol_name = null, $limit_symbol_name = null, $attributes = array()) { if (!is_integer($records)) { $records = count($records); } $limit_symbol_name = $limit_symbol_name ? $limit_symbol_name : moojon_config::get('paginator_limit_symbol_name'); if (!$limit) { $limit = moojon_request::has($limit_symbol_name) ? moojon_request::get($limit_symbol_name) : moojon_config::get('paginator_limit'); } if ($records > $limit) { $page_symbol_name = $page_symbol_name ? $page_symbol_name : moojon_config::get('paginator_page_symbol_name'); $page = moojon_request::has($page_symbol_name) ? moojon_request::get($page_symbol_name) : 1; $page = $page < 1 ? 1 : (int) $page; $children = array(); $params = moojon_get::get_data(); $get = $params; if (array_key_exists($limit_symbol_name, $get)) { $get[$limit_symbol_name] = $limit; } $get[$page_symbol_name] = ":{$page_symbol_name}"; foreach ($get as $key => $value) { $get[$key] = "{$key}={$value}"; } $querystring = moojon_uri::get_uri() . '?' . implode('&', $get); for ($i = 1; $i < ceil($records / $limit) + 1; $i++) { $params[$page_symbol_name] = $i; $attributes = $i == $page ? array('class' => 'selected') : array(); $children[] = li_tag(a_tag($i, moojon_base::parse_symbols($querystring, $params), $attributes)); } $return = ul_tag($children); } else { $return = ''; } return $return; }