• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XenForo_Link::buildPublicLink Help

MattW

Well-known member
#1
I'm trying to manually build a link back into the Showcase add-on, as I'm creating a custom page for the custom fields that have been introduced.
I've got the page working, but I'm trying to generate a link back to the item itself from the item_name field that is being extracted. I presume this is done with XenForo_Link::buildPublicLink, but I'm hitting a stubling block trying to get my head around it.

Here is what I've got so far:
PHP:
<?php
class PowerBoard_PowerBoardGarage
{
    public static function getPowerBoard(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
    {
        $db = XenForo_Application::getDb();
 
        $power = $db->fetchAll("
SELECT xf_nflj_showcase_custom_field_value.item_id, xf_nflj_showcase_custom_field_value.field_id, xf_nflj_showcase_custom_field_value.field_value, xf_nflj_showcase_item.item_id, xf_nflj_showc
ase_item.user_id, xf_nflj_showcase_item.item_name, xf_user.user_id, xf_user.username
FROM xf_nflj_showcase_custom_field_value
LEFT JOIN xf_nflj_showcase_item ON xf_nflj_showcase_custom_field_value.item_id = xf_nflj_showcase_item.item_id
LEFT JOIN xf_user ON xf_nflj_showcase_item.user_id = xf_user.user_id
WHERE xf_nflj_showcase_custom_field_value.field_id =  'bhp'
AND xf_nflj_showcase_custom_field_value.field_value !=  ''
ORDER BY xf_nflj_showcase_custom_field_value.field_value DESC
                                ");
 
                $response->params['power'] = $power;
    }
}
?>
That works at getting me the required information to add to the template:

HTML:
<xen:foreach loop="$power" value="$power">
<li>{$power.username} - <a href="{xen:link showcase, $item_name}">{xen:helper snippet, $power.item_name, 35}</a> = {$power.field_value} {$power.field_id}</li>
It works upto generating the link back into the showcase (garage in my case)

http://www.z22se.co.uk/forum/pages/powerboard/

and here is a full URL to an item

http://www.z22se.co.uk/forum/garage/opel-speedster-2839.18/

It's built up of item_name.item_id

Any pointers or tips would be much appreciated. (y)