Template parameters not being passed

ceribik

Well-known member
I have a hook that adds my own template to "message_user_info". The template "message_user_info" is included in "message" as followed:
Code:
    <xen:include template="message_user_info">
        <xen:map from="$message" to="$user" />
    </xen:include>

For some reason, I'm unable to access the array "message" in my template (I'm passing the parameters properly). I've tried variations such as "user", "post", "message", etc to no avail.

Any ideas?


On another note, what does this do?
Code:
<xen:map from="$message" to="$user" />

Thanks
 
Post your hook and your template. You might not be passing in the data correctly from the hook.
 
I'm fairly certain it's fine. Here are the relevant bits:

PHP:
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        if ($hookName == "message_user_info_text")
        {
 
            //die(Zend_Debug::dump($template->getParam("message")))
            //die(print_r($template->getParams()));
            //die(Zend_Debug::dump($template->getParams()));;
             
            $newContent = $template->create("MyTemplateBlah", $template->getParams())->render();
// note this code is incomplete
        }
    }
 
 
 
 
 
From the template, this is the variable that isn't working:
{$message.user_id}
 
PHP:
$contents .= $template->create("MyTemplateBlah", $template->getParams())->render();
 
I don't have any issue with my template not being inserted which is what you are assuming (due to failing to read my posts properly). The issue is with some of the parameters not being passed.
 
This is how I do mine... and they work just fine... sorry, just trying to help. I'll just shut the hell up from now on.

PHP:
                case 'account_alerts_extra':
                    $alertOptOuts = array('alertOptOuts' => $template->getParam('alertOptOuts'));
                       
                    $contents .= $template->create('xi_sportsbook_alert_preferences', $alertOptOuts);
                break;
 
Hmm. I managed to find the 'message' array parameter hiding in $hookParams, but that was missing the 'thread' array param, so using your idea, I made my own custom params array to pass into create()

Thanks :)
 
Back
Top Bottom