Jump to content

How to pass variables to templates?


Recommended Posts

I have a module from which I'm trying to define variables for use in the admin page templates. It looks like the 'AdminAreaPage' would be perfect for this, except that it doesn't work. My hook method gets called, and it returns an array as documented (e.g., return array('foo' => 'bar');), but I simply don't see the variables in the clientsummary template.

 

I've checked the Smarty variables by using {debug}, I've dumped all the PHP vars from within the scope of the template by using PHP's get_defined_vars() function, and I've even stepped into it with Xdebug: no sign of my variables, neither as top-level variables nor as elements buried inside a higher-order variable.

 

How do I access variables in a template defined by a hook function?

 

Related, is this even the best way to pass data into a template? I don't like the fact that this will break the simple turn on/off functionality that my module provides, but I do need to display data on the page. Has the module community established any sort of common convention or best practice in this area?

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated