LPH
Well-known member
Using an addon, I'm wanting to create a "page/section" called documentation.
I've followed the guide for building an addon to replace IndexAction for Members and the code works fine. Now, I'm trying to build a "Hello World" addon that would have the route
This is what I have so far in a file named
Next, I made a class extension for the base class
The next step is fuzzy to me. There needs to be a public router to the /documentation. I tried to add to Routes but wasn't sure.
Going to the url ]http://192.168.1.152:8888/community/documentation fails to load the hello world.
The message is saying it is an invalid controller but I thought
Does anyone have any suggestions for the next step?
I've followed the guide for building an addon to replace IndexAction for Members and the code works fine. Now, I'm trying to build a "Hello World" addon that would have the route
http://192.168.1.152:8888/community/documentation/
This is what I have so far in a file named
Documentation.php
:
PHP:
namespace TRN\HelloWorld\XF\Pub\Controller;
use XF\Pub\Controller\AbstractController;
use XF\Mvc\ParameterBag;
class Documentation extends AbstractController
{
public function actionIndex(ParameterBag $params)
{
return $this->message('Hello World');
}
}
Next, I made a class extension for the base class
XF\Pub\Controller\AbstractController
and assigned it to the addon. The next step is fuzzy to me. There needs to be a public router to the /documentation. I tried to add to Routes but wasn't sure.
Going to the url ]http://192.168.1.152:8888/community/documentation fails to load the hello world.
The requested page could not be found. (Code: invalid_controller, controller: XFocumentation, action: index)
The message is saying it is an invalid controller but I thought
XF: Documentation
was correct because I was following the index route.Does anyone have any suggestions for the next step?