コード例 #1
0
ファイル: Bootstrap.php プロジェクト: sonvq/2015_freelance6
 public function initRoutes()
 {
     $config = Zend_Registry::get('config');
     $this->_front->setBaseUrl($config->system->web->baseurl);
     $nl = array('content' => 'inhoud', 'news' => 'nieuws', 'events' => 'kalender', 'doctor' => 'team');
     $fr = array('content' => 'contenu', 'news' => 'nouvelles', 'events' => 'kalender', 'doctor' => 'team');
     $translator = new Zend_Translate('array', $nl, 'nl');
     $translator->addTranslation($fr, 'fr');
     $request = $this->getRequest();
     $languageTranslator = substr($request->getRequestUri(), 1, 2);
     $locales = $config->locale->list->toArray();
     if (!isset($locales[$languageTranslator])) {
         $languageTranslator = $config->locale->default;
     }
     $translator->setLocale($languageTranslator);
     Zend_Controller_Router_Route::setDefaultTranslator($translator);
     $router = $this->_front->getRouter();
     $localeRoute = new Zend_Controller_Router_Route(':lng', array('controller' => 'index', 'action' => 'content', 'module' => 'default', 'lng' => 'nl'), array('lng' => '(nl|fr)'));
     $router->addRoute('locale', $localeRoute);
     $contentRoute = new Zend_Controller_Router_Route_Regex('(.+)', array('controller' => 'index', 'action' => 'content', 'url' => null), array(1 => 'url'), '%s');
     $router->addRoute('content', $localeRoute->chain($contentRoute, '/'));
     $router->addRoute('events-index', $localeRoute->chain(new Zend_Controller_Router_Route('@events/*', array('controller' => 'events', 'action' => 'index')), '/'));
     $router->addRoute('events-detail', $localeRoute->chain(new Zend_Controller_Router_Route('@events/:id/:title', array('controller' => 'events', 'action' => 'detail'), array('id' => '\\d+')), '/'));
     $router->addRoute('contact', $localeRoute->chain(new Zend_Controller_Router_Route('@contact/*', array('controller' => 'contact', 'action' => 'form')), '/'));
     $router->addRoute('sitemap', $localeRoute->chain(new Zend_Controller_Router_Route('@sitemap/*', array('controller' => 'sitemap', 'action' => 'index')), '/'));
     $router->addRoute('doctor-index', $localeRoute->chain(new Zend_Controller_Router_Route('@doctor/*', array('controller' => 'doctor', 'action' => 'index')), '/'));
     $router->addRoute('doctor-detail', $localeRoute->chain(new Zend_Controller_Router_Route('@doctor/:id/:title', array('controller' => 'doctor', 'action' => 'detail'), array('id' => '\\d+')), '/'));
     $router->addRoute('ajax-captcha', $localeRoute->chain(new Zend_Controller_Router_Route('captcha', array('controller' => 'index', 'action' => 'ajaxcaptcha')), '/'));
     /* NEWS EXAMPLE */
     $router->addRoute('news-index', $localeRoute->chain(new Zend_Controller_Router_Route('@news/*', array('controller' => 'news', 'action' => 'index')), '/'));
     $router->addRoute('news-detail', $localeRoute->chain(new Zend_Controller_Router_Route('@news/:id/:title', array('controller' => 'news', 'action' => 'detail'), array('id' => '\\d+')), '/'));
     /* NEWS EXAMPLE END */
     $router->addRoute('admin', new Zend_Controller_Router_Route('admin/:controller/:action/*', array('controller' => 'index', 'action' => 'index', 'module' => 'admin')));
     $router->addRoute('file-download', new Zend_Controller_Router_Route_Regex('files/(.*)', array('controller' => 'file', 'action' => 'download'), array(1 => 'filename'), 'files%s'));
 }
コード例 #2
0
ファイル: Front.php プロジェクト: camilorivera/INNOVARE
 /**
  * Overload the setBaseURL method.
  */
 public function setBaseURL($base = null)
 {
     // First get the config object
     $registry = Zmax_Bootstrap::getRegistry();
     $zmax_context = $registry->get("zmax_context");
     $config = $zmax_context->config;
     // Remove the trailing '/'
     parent::setBaseUrl($this->cleanUrl($config->app->base_url));
 }
コード例 #3
0
ファイル: Bootstrapper.php プロジェクト: Cryde/sydney-core
 /**
  * Add modules
  */
 public function initModules()
 {
     $this->frontController->addModuleDirectory($this->corePath . '/application/modules');
     foreach ($this->modules as $module) {
         $this->frontController->addControllerDirectory($this->corePath . '/application/modules/' . $module . '/controllers', $module);
     }
     $this->frontController->setParam('useDefaultControllerAlways', true);
     $this->frontController->setBaseUrl($this->config->general->baseUrl);
     $this->registry->set('baseUrl', $this->config->general->baseUrl);
 }