There is a easy way to get zend framework 2 base path with domain name in layout.
1. In layout.phtml
$homeUrl = $this->url('home',array(),array('force_canonical' => true));
2.Adding home route in module.config.php
'home' => array( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array( 'route' => '/', 'defaults' => array( 'controller' => 'Application\Controller\Index', 'action' => 'index', ), ), ),
Simple as that.
adam wrote:
Man thanks for that! I was about to dig into Url helper/plugin class to look it up but found it first here.
Link | June 28th, 2013 at 13:45
Tong Uyen wrote:
Thank you very much.
Link | March 12th, 2015 at 12:52