Return a Xenforo template

  • Thread starter Thread starter Deleted member 10469
  • Start date Start date
D

Deleted member 10469

Guest
Hi, i have a .php.
I would like returned a xenforo template and passing variables.

My code :

PHP:
    // Secret BBcode (Display a message if the user has a specific id)
    public static function parseSecret(array $tag, array $rendererStates, &$parentClass)
    {
        if (!empty($tag['option']) && $parentClass->parseMultipleOptions($tag['option']))
        {
            $attributes = $parentClass->parseMultipleOptions($tag['option']); // Id's
            $userSecretMessage = $tag['children'][0]; // Message
 
            foreach($attributes as $usersId)
            {
                $usersIdString = $usersId . ',';
            }
 
            return /* HERE LOAD A XENFORO TEMPLATE AND PASSING VARIABLES */;
            // Variables to pass: $usersIdString and $userSecretMessage
        }
    }

How can I do that please ? :)
 
Example code from one of my addons:

Code:
				$template = new XenForo_Template_Public('nat_childlinks', array(
					'firstChildNodes' => $firstChildNodes,
					'selected' => $selectedTabId == 'nodetab' . $nodeTab['node_id'],
					'nodeTypes' => $nodeModel->getAllNodeTypes()
				));
				$childLinks = $template->render();

The template name is nat_childlinks. And it passes an array of template params. Then it renders the template and stores it in $childLinks.
 
Top Bottom