p410n3
Member
Hello. I am currently trying to get a simple add on up and running, but I already fail at displaying a view.
I build an controller and route using this as a reference: https://xenforo.com/xf2-docs/dev/lets-build-an-add-on/
But I get a template not found:
Code:
I build an controller and route using this as a reference: https://xenforo.com/xf2-docs/dev/lets-build-an-add-on/
But I get a template not found:
Code:
PHP:
<?php
//file: Pub/Controller/PrivacyController.php
namespace my\testaddon\Pub\Controller;
class PrivacyController extends \XF\Pub\Controller\AbstractController {
function actionIndex() {
$viewParams = [];
return $this->view('my\testaddon:View', 'Privacy', $viewParams);
}
}
HTML:
<!-- _output/templates/public/Privacy.html -->
<xf:title>Test</xf:title>
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, 'Template public...', 'src...', 583, Array)
#1 src/XF/Template/Templater.php(583): trigger_error('Template public...', 512)
#2 src/XF/Template/Templater.php(538): XF\Template\Templater->getTemplateData('public', 'Privacy')
#3 src/XF/Template/Templater.php(1248): XF\Template\Templater->getTemplateCode('public', 'Privacy')
#4 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('Privacy', Array)
#5 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#6 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('my\\testaddon:...', 'publicrivacy', Array)
#7 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#10 src/XF.php(328): XF\App->run()
#11 index.php(13): XF::runApp('XF\\Pub\\App')
#12 {main}
#1 src/XF/Template/Templater.php(583): trigger_error('Template public...', 512)
#2 src/XF/Template/Templater.php(538): XF\Template\Templater->getTemplateData('public', 'Privacy')
#3 src/XF/Template/Templater.php(1248): XF\Template\Templater->getTemplateCode('public', 'Privacy')
#4 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('Privacy', Array)
#5 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#6 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('my\\testaddon:...', 'publicrivacy', Array)
#7 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#10 src/XF.php(328): XF\App->run()
#11 index.php(13): XF::runApp('XF\\Pub\\App')
#12 {main}