创建路线?在控制器中的action_index?小花 [英] Creating a route? Within a controller action_index? Kohana
问题描述
我正在与kohana合作,因为开发进展非常快.现在,我想实现一些我无法真正想到的解决方法.
I am working with kohana, because development goes so pretty fast. Now I want to achieve something which I can't really think of a workaround for.
我想要实现的是,有一个控制器.它称为Controller_Restaurants
但是,这些餐馆是按省分组的,单击省份后,它们是按城市分组的,然后显示餐馆的列表.
What I want to achieve, there is a controller. It's called Controller_Restaurants
But those restaurants, are grouped by provinces and after province is clicked they are grouped by a city, and then a list of the restaurants is shown up.
所有城市和省份都已添加到带有字段的特定数据库中.
All cities and provinces are already added to there specific database with fields.
我想在控制器中创建一条路由.所以我可以实现以下链接:
I want to create a route in my controller. So can I achieve a following link:
domain/restaurants/province/city/restaurant-name
?
还是我想像冲洗器?否则我应该解决这个问题吗?
Or am I thinking like a douche and should I solve this otherwise?
推荐答案
构建您的路由,如下所示:
Build your routing like this:
Route::set('restaurants', 'restaurants(/<province>(/<city>(/<name>))))',
array(
'controller' => 'restaurants',
'action' => 'index',
));
它应该像这样工作.
这篇关于创建路线?在控制器中的action_index?小花的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!