I want each of this URL should point to single controller and action page/index. Inside this action I want to know from which url user came like cat1 or cat 2 or mayb different cat.
I tired doing in version 1.6.1 below but didn't work.
routes.php has ->
':segment' => 'page/index/$1'
controller page.php has ->
class Page extends Controller { public function action_index($cat) { // Here I get $cat as null which is supposed to be "catone" when i visit http://domain.com/catone } }
Thanks I put it to work. It's working, but now came up with another problem. What I did was:-
routes.php -> ':cat' => 'page/index'
controller file -> class Page extends Controller { public function action_index() { $p = $this->param('cat'); } }
In the same controller. I'm making one HMVC request. i.e. to another controller which nav/nav. Ofcourse nav matches with route ':cat' (I do have nav controller) and so its again going Pages controller... Page again calls nav controler... this way infinite loop goes on.
Is there a way I can fix this ? Or can I have something like this, that all my routes will be present in routes.php like
'catone' => 'page/index', 'cattwo' => 'page/index', 'catthree' => 'page/index', 'catfour' => 'page/index', (Categories are no more than 7).
But my concern is how would I know via which URL user came in?