I am intializing view placeholders in a bootstrap resource method like this:
protected function _initViewPlaceholders() {
$this->bootstrap("frontController");
$front=$this->getResource("frontController");
$this->bootstrap('view');
$view = $this->getResource('view');
$view->headLink()->appendStylesheet($view->baseUrl("path/to/stylesheet.css"));
$view->headScript()->appendFile($view->baseUrl("path/to/script.js"));
}
But the method does not work as expected - the style and script links have
no baseUrl prepended. When called from this method, $view->baseUrl() as well
as $front->getBaseUrl() return "/", although when called from an action
controller they return correctly autodetected baseUrl.
When I manually specify baseUrl in the config file:
resources.frontController.baseUrl = "/baseUrl"
the resource method works fine and files are linked correctly.
Which resource is responsible for injecting the autodetected baseUrl into
the front controller? Or am I missing the point completely? If yes, what is
the best practice for getting hold of the autodetected baseUrl in a
bootstrap resource method?
Thanks for any help,
David
ZF 1.10.1
--
View this message in context: http://n4.nabble.com/Autodetected-baseUrl-not-available-in-bootstrap-tp1568601p1568601.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论