I need to add a tag to the header开发者_如何学JAVA. I open page.tpl.php and I see this line:
<?php print $head; ?>
I assume I should write that tag somewhere else. What is the proper way of adding it? Thank you for the help.
You can use drupal_set_html_head()
to add a tag into the head section of the html
For example, drupal_set_html_head()
can optionally be used in template_preprocess_page()
as described here
If you're simply creating your own site, that's probably around the right place to do it, in page.tpl.php - somewhere between <head>
and </head>
. The template is as straightforward as it looks in that spot.
drupal_set_html_head()
is what you'd want to use if you are writing a Drupal module (so people who use your module get the appropriate header, no matter what theme they're using).
精彩评论