Creation of a pagination with $_POST data |
[eluser]jeanv[/eluser]
Hi everyone, i'm new in the community and this is my first post... Sorry if my english isn't that good, i'm not a native english speaker! Ok then, so my problem is about the pagination class and the fact that i need to keep the $_POST data to go from a page to another, and the second problem is the url written during the pagination... let me explain you that: For my pages i have only use a controller and a view file, no model. My code, in the controller is: Code: function index() Ok, with this code i have a "correct" pagination, i mean that when i click on the links created by the pagination, the results change and i can go from a page to another.... but it doesn't seem to be good code... i have to use the session library to keep the values and i don't know how the get the number of results for $config['total_rows']. AND... when for exemple i click on the link "2" (to go to page 2) of the pagination my url is: http://www.mysite.com/home/index/5 and if i click on the link "3" i have http://www.mysite.com/home/index/10 so i would like the point of view of people that know how to do it better because i would like to improve my code... (if possible without model file, i am not very used to MVC achitecture) Thanks a lot to the guys that will thake time to help me !
[eluser]Yash[/eluser]
I'm not going to touch your code.I can guide you. use models.Even for giving HTML based output.Use return in model function.From controller just query item. and then take data from model and print that.Easy? Try
[eluser]jeanv[/eluser]
hi Yash, as i said i didn't ask for someone to touche my code, i just nedd the best method to use the pagination class ! i'm going to try with a model file, i saw a few days ago a topic in the forum about that using a model file... thanks
[eluser]Yash[/eluser]
Just refer [url="http://ellislab.com/codeigniter/user-guide/general/models.htm"]user guide - Models[/url] very easy to use. Enjoy coding. |
Welcome Guest, Not a member yet? Register Sign In |