Reputation: 363
I'm attempting to create a custom display in yii2 framework using this code in my site controller:
/******/
public function actionChartDisplay()
{
return $this->render('chartDisplay');
}
for testing purposes I pasted the form name in my actionAbout function as a parameter to the render function in it. It worked with this:
public function actionAbout()
{
return $this->render('chartDisplay');
}
But I need to create many custom views in yii2 and this won't be a solution.
I'm curious as to why it is. Since I was following this tutorial and came across this weird behaviour. My 'chartDisplay.php' file is merely a "hello world" that does work with the action about function.
Upvotes: 0
Views: 1163
Reputation: 363
Apparently as @SmartCoder pointed out it was an error on how Yii2 Handles the action functions in its controller however I didn't mark his answer as the solution right away because implementing it resulted in an error. So aside from that I'm posting the way I solved it.
So instead of using chart-display I simply changed it for "charts" like this:
public function actionCharts(){
return $this->render('charts');
}
Changed the name of my file so it fits to charts.php
and it worked.
Upvotes: 0
Reputation: 411
in yii2, the controllers and actions with multiple words, that are marked by capital letters are divided by -
in your request, so in your case the route would be some/chart-display
Upvotes: 3