i have one module and would like to make or display 10 pages with url http://pit.localhost/t_history/1 and http://pit.localhost/t_history/2 and up to 10, but i kinda confuse if how am i gonna suppose to do it...do i have to make a lot of controllers? or does anyone does have a efficient way of doing it.
and follow up question, is my understanding correct that if the link is t_history/search/index does it mean that it redirects to a module name t_history and a .php file named search and a function name action_index like the same as t_affair/edit/edit leads to a action_edit function inside edit.php?
t_history/search/index: - could be: module t_history, controller Controller_Search, action_index - or: controller Controller_T_History, action_search, parameter 'index' - else a 404 (unless you have a route capturing this URL)
As to your first question, if you don't want the controller name and/or the action name in the URL, you need to define a route for it (in this case in your t_history module config/routes.php):
't_history/(:num)' => 't_history/pages/show/$1',
which would redirect the request to the controller Controller_Pages, action_show and will pass the number as an argument to the action.
how to pass a number sir with t_history/(:num)? is it history_forward( t_history/1) or am i wrng....
and another one, i added 't_history/1'='t_history/tenant/index' then it work...but the problem of that page is i cannot show the next links of my pagination cause i used tenant in the set function in pagination because if i use t_history/1 there i a smarty error
here is the real situation...i defined routes 't_history/1' => 't_history/search/tenants', 't_history/1/(:num)' => 't_history/search/tenants/$1', 't_history/2' => 't_history/search/affairs', 't_history/2/(:num)' => 't_history/search/affairs/$1', then the problem is when i go to t_history/1 the page goes to page 1 but in t_history/2 goes to page 2 of pagination even if the url is change into t_history/2/1 it wont go back to page 1? do you know how could this be fixed?
well i changed the links into this 't_history/1' => 't_history/search/tenants', 't_history/1/(:num)' => 't_history/search/tenants/$1', 't_history/2' => 't_history/search/affairs', 't_history/2/(:num)' => 't_history/search/affairs/$1', but still get the same result still still stuck in page in 1 in both pages though can't go to other links
correction it is change to this 't_history/tenants' => 't_history/search/tenants', 't_history/tenants/(:num)' => 't_history/search/tenants/$1', 't_history/affairs' => 't_history/search/affairs',
You need to get the page number in your controller, and use that to run the correct query.
Any additional URI segments are passed to the controller action as parameters:
namespace T_History;
class Controller_Search extends \Controller { public function action_tenants($page = null) { // make sure page contains something useful is_null($page) and $page = 1;
i change the value of segment from 2 to 3....can i ask what it really does? i really don't get it quite while reading the description of it the docs thanks