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

XenForo_Link::buildPublicLink Help

Discussion in 'XenForo Development Discussions' started by MattW, Mar 24, 2013.

  1. MattW

    MattW Well-Known Member

    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:
    class PowerBoard_PowerBoardGarage
        public static function 
    getPowerBoard(XenForo_ControllerPublic_Abstract $controllerXenForo_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:

    <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)


    and here is a full URL to an item


    It's built up of item_name.item_id

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

    Chris D XenForo Developer Staff Member

    Probably should be:

    {xen:link showcase, $power}

    In your template :)
    MattW likes this.
  3. MattW

    MattW Well-Known Member

    Holy s**t! Thanks Chris :)
    Chris D likes this.

Share This Page