Zend Framework is totally new for me, and I have problem with it. Probably it’s easy to fix, but I can’t find any solution in Google.
I can’t figure out how to set correct path to public folder. Im using xampp as virtualhost, my current full path looks like this:
localhost/zf_project/public/controller/action
Now, when I’m using forms and links it moves me to localhost/controller/action, so currently I’m adding everywhere:
$front = Zend_Controller_Front::getInstance();
$form->setAction($front->getBaseUrl().'/controller/action');
Probably there is simplest way to set default path to public folder.
I tried add in my .ini application file:
resources.frontController.baseurl = "/zf_project/public"
ZF can determine your base URL without having to set it in your config file or from the bootstrap.
From views, you can construct links with the base URL using the
baseUrlhelper.You can construct URLs using the
urlhelper. This constructs your URLs based on the routes configured.You can use either of these helpers from your controllers too, just specify the view object when you want to call them:
Pretty much anywhere I reference images, javascripts, css files, or static content I use the
baseUrlhelper. Any time I want to link to other controllers or actions within my application, I use theurlhelper since it constructs valid URLs using your routes. That way if you change your URL structure, theurlhelper will reflect the changes and you don’t have to modify your existing code.