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

709 Views Asked by At

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

1

There are 1 best solutions below

1
On BEST ANSWER
$this->baseUrl('/home'); 

should work