Search code examples
zend-frameworkurl-helper

error with url helper, $this->url(array(), 'home'); generate a link like this http///home


error with url helper, $this->url(array(), 'home'); generate a link like this http///home

Hi,

I've create a custom route in my application.ini file like this:

resources.router.routes.home.route = /home
resources.router.routes.home.defaults.module = default
resources.router.routes.home.defaults.controller = index
resources.router.routes.home.defaults.action = index

and in my master layout I want to write a link to my the home page like this

<a href="<?php echo $this->url(array(), 'home'); ?>">Home</a>

but I got in the generated html file,
http///home,
can someone help me to get the url in this form /home, or http//example.com/home, ?
Thanks


Solution

  • $this->baseUrl('/home'); 
    

    should work