Hello everyone,
I have been working on a zend framework project on localhost (OS: Snow Leopard) and when I uploaded the files on the hosting server (shared hosting) I got some errors about a view helper i was using there.
More specifically:
The project structure is like this: ( i ommited some irrelevant subfolders and the numbers in the paranthesis is just for reference in here, it is not included in the folder name in the project)
application -configs -controllers -layouts --scripts -models -modules --admin ---controllers ---models ---views(2) ----filters ----helpers(2) ----scripts -views(1) --helpers(1) --scripts library public
In the helpers(1) folder i have a view helper, BaseURL.php:
class Zend_View_Helper_BaseURL
{
function baseURL()
{
$fc = Zend_Controller_Front::getInstance();
return $fc->getBaseUrl();
}
}
I use it, for example , in the layout to write the paths for stuff like CSS files, JS files, something like this:
<script src="<?php echo $this->baseURL();?>/public/js/somejavascript.js></script>
And usually i use it when i need the base url (not only in layouts,also in views). I have been using the same helper in the 'default' module of the application and in the 'admin' module (modules/admin/...). Localy, everything went ok, no issues. When i uploaded the project, i got errors like:
An error occurred
Application error
Exception information:
Message: Plugin by name 'BaseURL' was not found in the registry; used paths: Cmsadmin_View_Helper_: /path_to_site_like_public_html/application/modules/cmsadmin/views/helpers/ Zend_View_Helper_: Zend/View/Helper/
The error above was for a line using $this->baseURL() in the admin layout (which is called in the admin module).
At first i thought maybe because the helper is declared in another module (the default module), its not found by the framework in the admin module. But why locally everything works ? I dont get it. Also, if i change $this->baseURL() to $this->baseUrl() in the same admin.phtml layout file, in the admin module, everything works (online and locally).
If someone could enlighten me to whatever it is i am missing, i'd appreciate it.
P.S.: Since its not yet clear in my head, maybe someone could tell me : a helper declared in a module is available in all modules of the website? ( the local development told me it is, since its working locally, but then whats wrong with the uploaded project?).
Thanks.