Zend_View_Helper_Navigation_Menu creates an url I didn't expect
I used a small tutorial to create a menu through the Navigation_Menu view helper. I created my Zend folder inside a subfolder of localhost so now I can access this in my brwoser with
localhost/project/public
Now the menu gets a relative url from my config. For instance 'about' maps to /index/about
.开发者_Go百科 Now my view helper maps 'about' to localhost/index/about
. How can I map this to localhost/project/public/index/about
without altering my config file?
Most probably, this is not Zend specific, so correct me if I'm wrong.
Assuming you are using Xampp/Apache lokal Webserver, here's the HowTo on setting up a local Domain
- Go to your
$xamppRoot / apache / conf / extra
Folder - Inside that open
http-vhosts.conf
- In the Top commented area, make sure to uncomment the following line NameVirtualHost *:80
Now comes the variable part and i will just post my Structure. You may edit
Servername
(which basically is the url/domain),DocumentRoot
(which is the path to project/public),SetEnv APPLICATION_ENV $yourenv
(Zend Config Environment) and<Directory ...>
(which once again is the path to project/public)<Virtualhost *:80> ServerName hod.dev DocumentRoot "C:\xampp\htdocs\prvt\cahod\public" SetEnv APPLICATION_ENV "local" <Directory C:\xampp\htdocs\prvt\cahod\public> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
With this your Apache now knows how to Set up a local domain. The only thing left to do now is to make your local machine not access the internet when accessing http://hod.dev
- Go to Windows / system32 / drivers / etc
- Open
HOSTS
(you may use a simple text editor) - Inside this you'll see some lines already
- Just add
127.0.0.1 hod.dev
- Save it and have fun with your local domain
PS: I'm sorry that the code-block above does look shitty, but somehow it doesn't work really well in here - breaks the code somehow :(
Maybe you need to set or change the baseUrl
parameter in your configuration file. Something like the following:
resources.frontController.baseUrl = "/project/public"
Hope that helps,
精彩评论