Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
pagenation rendering
Gaurish
January 2014
this is my controller code:
$view = View::forge('page');
$view->name = "Santosh";
$pagination = Pagination::forge('mypagination', array(
'pagination_url' => '
http://localhost/fuelphpn/public/page/index/'
,
'uri_segment' => 2,
'total_items' => 3,
'per_page' => 3,
));
$data = Model_Pagetable::query()
->limit($pagination->per_page)
->offset($pagination->offset)
->get();
$view->page =Pagination::instance('mypagination')->pages_render();
$view->data = $data;
return $view;
and this view i am echo this code but i am not able to see the page link code
and also the link to other page is not proper and i am not able to see the next iteams
Please help me in this this is the last phase of my fuelphp learn task.
please help
Harro
January 2014
You're storing the rendered HTML into $view->page, which will be escaped by the View object.
Either use
$view->set_safe('page',
Pagination::instance('mypagination')->pages_render());
or pass the Pagination instance itself to the View. When you echo the instance, the object will auto-render itself.
Also, you have defined uri_segment 2, but in the pagination_url, the segment for the page number is 3 (page is 1, index is 2).
Gaurish
January 2014
i am able to solve the current problem But i have another problem,
My URL is not right the next or the pageing button are not right that are as follow :
http://localhost/fuelphpn/public/3/index
it Should be
http://localhost/fuelphpn/public/index/3
but the current page URL is right i have set the url is this way.
'pagination_url' => '
http://localhost/fuelphpn/public/page/index/'
,
and thankx for the early problem.
Gaurish
January 2014
and i still confuse about uri_segment if i am seting it for 5 then my pagenation link is set properly,
but the result is not what i want or it is not the next record it is the same record,
wht is url segment need to do with the result
Harro
January 2014
My previous reply is wrong, I'd assumed some rewriting was used, but it looks like your public folder is actually part of the URL...
For the uri_segment, ALL segments in the URL are counted (excluding the hostname, since that is not a segment). So for
'pagination_url' => '
http://localhost/fuelphpn/public/page/index/'
,
the uri_segment should be 5, since there are 4 existing segments (fuelphpn, public, page and index), and which will create
http://localhost/fuelphpn/public/page/index/3
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Gaurish
January 2014
Harro
January 2014