Render HTML (not in template)


Well-known member
So I'm writing html to an output in the XF data folder. Now I want to get that output and send it as a viewParam to the template. The way I'm doing it successfully is as follows:

        $helper = new Teamspeak_Helper_Information();
        $account = new XenForo_ControllerHelper_Account($this);

        $options = XenForo_Application::get('options');
        $path = XenForo_Application::get('config')->externalDataPath;
        $path = $options->boardUrl . '/' . $path . '/teamspeak/viewer.html';

        $viewParams = array(
            //'viewer' => $helper->teamspeakViewer()
            'viewer' => file_get_contents($path)

        return $account->getWrapper('account', 'teamspeak',
            $this->responseView('Teamspeak_ViewPublic_Account_Viewer', 'account_teamspeak_viewer', $viewParams)
However this is extremely clunky and slow. What would a much more optimized way of doing this be since I can't think of a way D: