i make index action in which i want to get data of calender and show this data using index.phtml but always no calendar shown,how i show calendar data? here is my indexaction:>
You need a view model to render your data. Instead of
return array('calendars' => $calendars);
You want this for a View:
$viewModel = new ViewModel
(
array
(
'calendars' => $calendars,
)
);
return $viewModel;
or this for Json:
$jsonModel = new JsonModel
(
array
(
'calendars' => $calendars,
)
);
return $jsonModel;
make sure to add the use statements for your controller:
use Zend\View\Model\ViewModel;
use Zend\View\Model\JsonModel;
If you want to specify a specific view you can use:
$viewModel->setTemplate('path/to/specific/view.phtml');
or
$viewModel->setTemplate('mapping/for/specifc/view');
with the mapping specified in your module config