|
|||
|
Hello everyone,
I would like to get the baseUrl and set that value in the placeholder collection. Code:
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
$view->placeholder('baseurl')->baseurl = $baseUrl;
If I dump $baseUrl or $frontController, $baseUrl is null as well as the baseUrl within the $frontController. What I am ultimately attempting to accomplish is to have simple links in my view. If I don't use the baseUrl, the destination URL continues to get added to (as many of you already know). So, /index/list will become someething like /index/index/index/list after the link is clicked a few times. Any advice would be most appreciated. Thanks in advance. |
|
|||
|
Perhaps my understanding of the 'baseUrl' was inaccurate. It was my understanding that the framework would be able to derive the baseUrl somehow. Apparently either this is not the case or was simply not working.
I resolved the issue by setting the baseUrl to the location where the webserver thinks the root document is located. So, if my Apache installation (Linux) is pointing to '/var/www/zfApp/document_root' and is aliased '/zf' then the baseUrl needs to be set to '/zf' edit: It also helps to make sure that if you use apache on a linux system to add "AllowOverride All" as an option for the app's doc_root directory. That seems to resolve my issues. ![]() Last edited by Howler9443 : 04-10-2008 at 01:45 PM. Reason: update |
|
||||
|
You should be able to get the baseUrl from the frontController, but it will only be populated after the frongController has initialized the necessary components. I provide the baseUrl to all my views by using a view helper. For some help getting up and going with view helpers check out Naneau The magic of view helpers
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|