Zend Framework: how to use baseUrl as used in Code Igniter
In Ze开发者_StackOverflow中文版nd Framework, baseUrl
adds path as '/user/local/path_tyo_file'
. Is there any function which adds path like 'http://mydomain.com/images/show.jpg'
, as base_url
in code igniter does?
You can set up the baseUrl in your Bootstrap.php file by using an initView method. This is also a good way of doing any general view work and keeping it out of your controllers.
protected function _initView()
{
$view = new Zend_View();
$view->getHelper('BaseUrl')->setBaseUrl('http://mydomain.com');
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
'ViewRenderer'
);
$viewRenderer->setView($view);
return $view;
}
Can you provide a code example for where and how you use baseUrl. Where is that path coming from? Do you use Zend stand-alone or with the MVC framework?
In my MVC frameworks I don't have and see any use for the baseUrl and initially the baseUrl is empty and afaik it is something that needs to be manually configured. I don't know code igniter so I don't understand what you are trying to achieve.
精彩评论