Mam problem z paginacją, otóż wykorzystałem bibliotekę pagination i stworzyłem sobie proste stronicowanie. Jednakże przy przechodzeniu na poszczególne strony pojawia się błąd. Generowany jest np taki link
http://localhost/heniek_cms/adm/menu_1/2Tak też być powinno, ale kiedy wciskam pojawia się: Wywołana strona, adm/menu_1/2, nie może zostać znaleziona.
Kod configu:
<?php
/**
* @package Pagination
*
* Pagination configuration is defined in groups which allows you to easily switch
* between different pagination settings for different website sections.
* Note: all groups inherit and overwrite the default group.
*
* Group Options:
* directory - Views folder in which your pagination style templates reside
* style - Pagination style template (matches view filename)
* uri_segment - URI segment (int or 'label') in which the current page number can be found
* query_string - Alternative to uri_segment: query string key that contains the page number
* items_per_page - Number of items to display per page
* auto_hide - Automatically hides pagination for single pages
*/
$config['default'] = array (
'directory' => 'pagination',
'style' => 'digg',
'uri_segment' => 3,
'query_string' => '',
'items_per_page' => 2,
'auto_hide' => TRUE,
);
?>
Kod kontrolera:
<?php
public function index($pagenum=1)
{
$view = new View('layout/adm');
$menu = new Admin_Menu_Model;
$view->menu = $menu->menu_adm();
$shoutbox = new Admin_Shoutbox_Model;
$view->shoutbox = $shoutbox->shoutbox_adm();
$view->content = new View('adm/menu/wybierz_1');
$view->content -> title = \"Wybierz menu 1 poziomu\";
$view->username = Simple_Auth::instance()->get_user();
$view->content -> error = Session :: get('menu');
$view->content -> ile = Simple_Modeler::factory('Admin_Menu_1')->count_all();
$paging = new Pagination(
'total_items' => $view->content -> ile,
'uri_segment' => 'index',
'base_url' => 'adm/menu_1/',
));
$view->content->pagination = $paging;
$view->content -> edytuj = Simple_Modeler::factory('Admin_Menu_1') -> select('id','tekst') -> limit($paging->items_per_page, $paging->sql_offset) -> fetch_all('kolejnosc', 'ASC');
$view->author = Kohana::config('settings.author');
$view->charset = Kohana::config('settings.charset');
$view->copyright = Kohana::config('settings.copyright');
$view->library = new Heniek;
$view->render(true);
}
?>
Częściowo ten problem rozwiązałem, gdyż już strony mi się wyświetlają poprawnie, ale link wygląda tak: adm/menu_1/index/2 a chciałbym mieć tak: adm/menu_1/2
Ten post edytował henio 18.07.2009, 18:32:33