コード例 #1
0
ファイル: routing.cfg.php プロジェクト: hosivan90/toxotes
<?php

$r = array('__urlSuffix__' => '.html', '__remap__' => array('route' => 'frontend/default'), '/' => array('route' => 'frontend/default'), '{controller}' => array('route' => '{controller}/default'), '{controller}/{action}' => array('route' => '{controller}/{action}'), '{controller}/{action}/{id:\\d+}' => array('route' => '{controller}/{action}'), 'danh-muc/{slug:[a-zA-Z0-9-]+}-{id:\\d+}' => ['route' => 'category/default'], 'bai-viet/{slug:[a-zA-Z0-9-]+}-{id:\\d+}' => ['route' => 'post/detail'], 'nhom-san-pham/{slug:[a-zA-Z0-9-]+}-{id:\\d+}' => ['route' => 'products/category'], 'san-pham/{slug:[a-zA-Z0-9-]+}-{id:\\d+}' => ['route' => 'products/detail'], 'gio-hang' => ['route' => 'products/cart']);
$r = \Toxotes\Cms::route($r);
return $r;
コード例 #2
0
ファイル: routing.cfg.php プロジェクト: hosivan90/toxotes
<?php

use Toxotes\Cms;
$r = array('__urlSuffix__' => '.html', '__remap__' => array('route' => 'dashboard/default'), '/' => array('route' => 'dashboard/default'), '{controller}' => array('route' => '{controller}/default'), '{controller}/{action}' => array('route' => '{controller}/{action}'), '{controller}/{action}/{id:\\d+}' => array('route' => '{controller}/{action}'));
return Cms::route($r);
コード例 #3
0
ファイル: Controller.php プロジェクト: hosivan90/toxotes
 protected function _initLanguages()
 {
     $this->languages = \Languages::findByPublished(true);
     if (sizeof($this->languages) < 2) {
         $this->currentLang = $this->languages[0];
         return;
     }
     $currentLangCode = $this->request()->get('lang');
     if (!$currentLangCode) {
         $currentLangCode = Factory::getCookie()->read('lang');
     }
     if (!$currentLangCode) {
         $this->currentLang = \Languages::findOneByDefault(true);
         $currentLangCode = $this->currentLang->getLangCode();
     }
     Factory::getCookie()->write('lang', $currentLangCode);
     if (Factory::getRouter()->getUrl() == '/' && !$this->request()->get('lang')) {
         $this->redirect($currentLangCode);
     }
     if (!$this->currentLang) {
         $this->currentLang = \Languages::findOneByLangCode($currentLangCode);
     }
     $translator = Translator::getInstance();
     $translator->setLocale($currentLangCode);
     Cms::$currentLang = $this->currentLang;
 }