本文整理汇总了PHP中Zend_Controller_Front::setBaseUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Front::setBaseUrl方法的具体用法?PHP Zend_Controller_Front::setBaseUrl怎么用?PHP Zend_Controller_Front::setBaseUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Front
的用法示例。
在下文中一共展示了Zend_Controller_Front::setBaseUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initRoutes
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: setBaseURL
/**
* 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: initModules
/**
* 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);
}