I have created a simple User Module with 3 views (index, login, register). I am trying to map them to the IndexController in User module which has following code. The code is running without any error, BUT IS NOT DISPLAYING THE TEMPLATES
Controller code in : User\src\users\Controllers\IndexController
namespace Users\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Helper\ViewModel;
class IndexController extends AbstractActionController
{
public function indexAction()
{
$view = new ViewModel();
return $view;
}
public function registerAction()
{
$view = new ViewModel();
$view->setTemplate('users/index/new-user.phtml');
return $view;
}
public function loginAction()
{
$view = new ViewModel();
$view->setTemplate('users/index/login');
return $view;
}
}
And the templates in View are
User\view\index\index.phtml
<h1>Welcome to Users Module</h1>
<a href="/users/index/login">Login</a>
<br> <br>
<a href="/users/index/register">New User Registration</a>
User\view\index\login.phtml
<h2> Login </h2>
<p> This page will hold the content for the login form </p>
<a href="/users"><< Back to Home</a>
User\view\index\new-user.phtml
<h2> New User Registration </h2>
<p> This page will hold the content for the registration form </p>
<a href="/users"><< Back to Home</a>