XF 1.5 Problem with route and view controller

rhodes

Active member
Hello,

today I’ve tried to create my first add-on on my development server. This add-on should listen to

develop.dev/forums/buecher

and just show a simple template “wr_buecher” (Content = “Hello World”). This sounds not too sophisticated, but I got stuck. I can call /forums/buecher but no content is shown. There is also no error message. Maybe the more experienced here have any idea.

The directories and files

— Whatchareadin
—— Buecher
———ControllerPublic
—————Buecher.php
—--- Route
---------Prefix
---————Buecher.php

library/Whatchareadin/Buecher/Route/Prefix/Buecher.php

PHP:
class Whatchareadin_Buecher_Route_Prefix_Buecher implements XenForo_Route_Interface
{
    /**
     * Match a specific route for an already matched prefix.
     *
     * @see XenForo_Route_Interface::match()
     */
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        return $router->getRouteMatch('Whatchareadin_Buecher_ControllerPublic_Buecher', $routePath);
    }
    
}


library/Whatchareadin/Buecher/ControllerPublic/Buecher.php

PHP:
class Whatchareadin_Buecher_ControllerPublic_Buecher extends XenForo_ControllerPublic_Abstract
{
   public function actionIndex()
   {
     $viewParams = array( );  //  this would include any variables that you want to send to your template
     return $this->responseView('Whatchareadin_Buecher_ViewPublic_Buecher', 'wr_buecher', $viewParams);   
   }
}

I also have defined a route prefix in the ACP. Please see the screenshot attached, but it seems as if template wr_buecher is never fetched. Any ideas?
 

Attachments

  • Bildschirmfoto 2017-12-23 um 11.53.01.webp
    Bildschirmfoto 2017-12-23 um 11.53.01.webp
    14 KB · Views: 3
Top Bottom