I want to render a (non-CP) template from an action method in my plugin controller over a route I defined in the plugin base class:
function registerSiteRoutes() {
return array(
'myservice' => array('action' => 'pluginhandle/controller/method')
);
}
The action itself basically just sets some things up and renders the template:
public function actionMethod()
{
// irrelevant code here...
$variables = array('info' => 'success');
$this->renderTemplate('pluginhandle/template', $variables);
}
But when trying to access the rendered template via it's routed url '/myservice', an error message is shown telling the template can't be found.
Strangely, it seems to work if I use the full action url actions/pluginhandle/controller/method
instead. But, I want to have nice URLs if I can have them, right?
I tried it using craft()->templates->render('pluginhandle/template')
and $this->renderPluginTemplate('pluginhandle/template')
even temporarily setting a new templates path but none of them seems to change that.
Can someone please help me out?