тоже решила попробывать сделать постраничный вывод. ничего не получается. скорее всего чет с роутами наделала не то.
в общем
роуты:
Код:
Route::set('default', '(/page<id>)')
->defaults(array(
'controller' => 'customer',
'action' => 'index',
));
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'main',
'action' => 'index',
));
Код:
контроллер:
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Customer extends Controller_Template {
public $template = 'base'; //загрузка базового вида
public function action_index()
{
//pagination
$count = ORM::factory('customer')->count_all();
// передаем значение количества пользователей в модуль pagination и формируем ссылки
$pagination = Pagination::factory(array('total_items' => $count))
->route_params(array('controller' => Request::current()
->controller(), 'action' => Request::current()->action(),));
//получаем пользователей с указанной позиции ($pagination->offset)
//и указанное количество на страницу ($pagination->items_per_page)
$offset = ($this->request->param('id'))? $this->request->param('id') : 1;
$cuspag = ORM::factory('customer')
->limit($pagination->items_per_page)
->offset(offset(($offset - 1) * $pagination->items_per_page))
->find_all();
//вывод всех заказчиков
$customers = array();
$content = View::factory('customerview')
->bind('customers', $customers)
->bind('pagination', $pagination)
->bind('cuspag', $cuspag);
$customer = new Model_Customer();
$customers = $customer->get_all();
$this->template->content = $content;
}
}
ссылка на страницу с customer
http://lern/customer/роут на главную страницу продолжает нормально работать а при переходе на customer пишет, что "Удаленный сервер или файл не найден"
есно дело проблема в роутах, кучу перепробывала вариантов((((