Posted by kiran_lakhotia on March 14, 2008 at 3:42pm
| Project: | Sitemap |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi,
I've added a pagination feature for the taxonomy list on the site_map page. The pagination can be controlled via the admin section (no pagination, 100 items per page, 200 items per page, etc.).
This is a relatively small fix in the following functions
function site_map_admin_settings()
to save the pagination settings, and function
<?php
function _site_map_taxonomy_tree($vid, $name = NULL, $description = NULL){
...
/**optional pager**/
$show_pager = false;
$page_increment = variable_get("site_map_taxonomy_tree_page_increment", 0);
$total_entries = count($tree);
$display_count = $total_entries;
$current_page = 0;
$start_from = 0;
if($page_increment > 0){
$show_pager = true;
$current_page = $_GET['page'] ? $_GET['page'] : 0;
$display_count = intval(($current_page + 1) * $page_increment);
$start_from = $current_page * $page_increment;
$display_count = ($display_count >= $total_entries)? $total_entries:$display_count;
$GLOBALS['pager_page_array'][] = $current_page;
$GLOBALS['pager_total'][] = intval($total_entries / $page_increment) + 1;
}
/**end optional pager**/
for($pager_count = $start_from; $pager_count < $display_count; $pager_count++) {
$term = $tree[$pager_count];
.....
}
....
if($show_pager === true){
$output .= theme('pager', NULL, $page_increment);
}
....
?>Is there interest for a patch for this?
Comments
#1
Here is the patch for the pagination feature.
Kiran
#2
Dear all,
here is a new patch for the pagination, which contains some bug fixes. The pagination only applies to the vocabulary list and can be controlled via the site_map configuration page.
As a result of this patch, the term lists have to be traversed twice, rather than only once in the original code. This was done to minimize the changes to the original module.
Kiran