Posted by luyendao on April 11, 2006 at 4:59pm
I have my main (phptemplate) page template working fine, but when i view system areas (like user profile, login), there's a small layout break which I think is attributed to me removing the tag
<?php
print $closure;
?>Can anybody tell exactly what this tag does? Does it just render a closing div tag ?
Thanks for any help.
Comments
this
search http://drupal.org/search/node/%24closure%3B+type%3Abook
takes you to this page
http://drupal.org/node/11812
which has this line
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
...
Thanks Steven for the reference and link, i'll know where to look in the future as well.
Lu
Learning the tools of an
Learning the tools of an environment is just one of the steps of learning a given product. That's why I laid out the steps of how I found the answer. For you and others who cme across the thread.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
and 5 years later
And 5 years later, your advice is still good. :)
But what does that mean?
I have already found the above reference to $closure, but what exactly does that mean?
Can I use it to insert some javascript at the end of the page? This is something I need to do and currently I have the code directly in page.tpl.php but this is not a very elegant solution. If I could store it somewhere in the database so it is rendered as $closure then that would be a) much neater and b) mean that I don't have to remember to hack every theme I use.
There seems to be nowhere to set $closure through the admin interface. Perhaps it is something that has to be set through a hook function, possibly in template.php (although that would still necessitate changes to every theme used)?
Any light that could be shed would be appreciated.
--
Artemis Studios | Artemis Agency
Still looking for $closure
nasi - I am curious about this too, and I am very new to Drupal and PHP. Here's some relevant info:
from theme_closure() on api.drupal.org:
from hook_footer() on api.drupal.org:
From what I can tell so far, various modules (such as WYSIWYG editors) can put javascript info into the $closure variable by using the hook_footer() function. Being a super-newbie, I don't know how to use hooks yet, or where I might use this function outside of building a new module. Bet here's a page talking about what hooks are for what it's worth...
Google Analytics
If you don't include the
<?phpprint $closure;
?>
Still A Drupal Newbie, But Learning Quickly
Classic and Vintage Japanese Cars | Datsun 240z and 260z Club of Australia | My Blo