diff --git a/src/Api/Question.php b/src/Api/Question.php index 69e67f1..af0fce7 100644 --- a/src/Api/Question.php +++ b/src/Api/Question.php @@ -60,6 +60,7 @@ public function canonizeQuestion($question) // Set tags if (!empty($question['tag'])) { $tags = Json::decode($question['tag']); + $tags = array_unique($tags); foreach ($tags as $tag) { $tagList[] = array( 'term' => $tag, @@ -67,7 +68,7 @@ public function canonizeQuestion($question) 'module' => $this->getModule(), 'controller' => 'tag', 'action' => 'term', - 'slug' => urlencode($tag), + 'slug' => $tag, ))), ); } diff --git a/src/Controller/Front/IndexController.php b/src/Controller/Front/IndexController.php index 9a3d5e6..f70893b 100644 --- a/src/Controller/Front/IndexController.php +++ b/src/Controller/Front/IndexController.php @@ -67,8 +67,9 @@ public function askList($where) public function askPaginator($template, $where) { $template['module'] = $this->params('module'); - $template['order'] = $this->params('order'); + //$template['order'] = $this->params('order'); $template['page'] = $this->params('page', 1); + $template['slug'] = $this->params('slug'); // get count $columns = array('count' => new Expression('count(*)')); $select = $this->getModel('question')->select()->where($where)->columns($columns); @@ -84,7 +85,8 @@ public function askPaginator($template, $where) 'module' => $this->getModule(), 'controller' => $template['controller'], 'action' => $template['action'], - 'order' => $template['order'], + //'order' => $template['order'], + 'slug' => urlencode($template['slug']), )), )); return $paginator; diff --git a/src/Controller/Front/TagController.php b/src/Controller/Front/TagController.php index 4914609..61c977e 100644 --- a/src/Controller/Front/TagController.php +++ b/src/Controller/Front/TagController.php @@ -33,7 +33,7 @@ public function termAction() // Check slug if (!isset($slug) || empty($slug)) { $url = array('', 'module' => $module, 'controller' => 'index', 'action' => 'index'); - $this->jump($url, __('The tag not set.'), 'error'); + //$this->jump($url, __('The tag not set.'), 'error'); } // Get id from tag module $tagId = array(); @@ -44,7 +44,7 @@ public function termAction() // Check slug if (empty($tagId)) { $url = array('', 'module' => $module, 'controller' => 'index', 'action' => 'index'); - $this->jump($url, __('The tag not found.'), 'error'); + //$this->jump($url, __('The tag not found.'), 'error'); } // Set question info $where = array('status' => 1, 'type' => 'Q', 'id' => $tagId); diff --git a/src/Route/Ask.php b/src/Route/Ask.php index c96e3a6..7633677 100644 --- a/src/Route/Ask.php +++ b/src/Route/Ask.php @@ -119,7 +119,7 @@ public function assemble( $url['action'] = $mergedParams['action']; } if (!empty($mergedParams['slug'])) { - $url['slug'] = $mergedParams['slug']; + $url['slug'] = urlencode($mergedParams['slug']); } if (!empty($mergedParams['order'])) { $url['order'] = 'order' . $this->paramDelimiter . $mergedParams['order'];