Dannymh
Active member
Hi,
I am writing an addon which uses a route for mvp, my route file looks like
I then have a few links within my templates that get built as you click through the various depths of the addon, these links look like
If I click on the first link it takes me to the correct controller which is Silvertails_Mvp_ControllerPublic_App and calls the action action of actionGames this then goes through my route prefix correctly and i can access both title and id
if I then got through the second link again it calls the correct controller and correct action, however the route doesnt seem to work properly and only ID is available but title isn't.
If I do a print_r within by buildlink it for $data it comes up as blank.
I can't see what would stop this working from one function to the next as they are identical in the way they do things and only differ in the model and template they call.
Any ideas?
I am writing an addon which uses a route for mvp, my route file looks like
PHP:
<?php
class Silvertails_Mvp_Route_Prefix_Mvp implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'id');
return $router->getRouteMatch('Silvertails_Mvp_ControllerPublic_App', $action, 'mvp');
}
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'id', 'title');
}
}
I then have a few links within my templates that get built as you click through the various depths of the addon, these links look like
PHP:
<a href="{xen:link 'mvp/games', {xen:array 'id={$season.id}', 'title={$season.season_name}'}}">{xen:phrase silvertails_mvp_view} {xen:phrase silvertails_mvp_games}</a>
<a href="{xen:link 'mvp/leaders', {xen:array 'id={$game.id}', 'title={$game.round_name}'}}">{xen:phrase silvertails_mvp_view} {xen:phrase silvertails_mvp_votes}</a>
If I click on the first link it takes me to the correct controller which is Silvertails_Mvp_ControllerPublic_App and calls the action action of actionGames this then goes through my route prefix correctly and i can access both title and id
if I then got through the second link again it calls the correct controller and correct action, however the route doesnt seem to work properly and only ID is available but title isn't.
If I do a print_r within by buildlink it for $data it comes up as blank.
I can't see what would stop this working from one function to the next as they are identical in the way they do things and only differ in the model and template they call.
Any ideas?