How can I include HTML code in the head?

Christian Zwahlen - July 9, 2007 - 11:09

How can I include HTML or PHP code in the head () with a module?

Use the Drupal function drupal_set_html_head()

jsloan - July 9, 2007 - 12:42

To send the HTML use drupal_set_html_head()

The code in "test.module"

Christian Zwahlen - July 9, 2007 - 13:49

The code in "test.module" dont work:

function drupal_set_header() {

  include "test.html";
//  include "test.php";
}

Error in the browser: "Fatal error: Cannot redeclare drupal_set_header() (previously declared"

Cannot redeclare drupal_set_header()

jsloan - July 9, 2007 - 15:12

... this function is to be called, not declared. And it was the wrong function. I was referring to drupal_set_html_head() and got the URL wrong, sorry: http://api.drupal.org/api/5/function/drupal_set_html_head

I've got a feeling that you want to include some HTML at the top of the web page rather than alter the HTML head. So take a look at the Module developer's guide: http://drupal.org/node/508 and perhaps also the Theme developer's guide: http://drupal.org/node/509

This may help you define precisely what you want to accomplish.

 
 

Drupal is a registered trademark of Dries Buytaert.