Where is the $head defined in this theme? Is it pulling info from a function?

If you want to add meta data, is this what you would adjust/add to?

Comments

andrewmacpherson’s picture

The $head variable is produced by the core drupal theme layer, in includes/theme.inc (line 1807 for drupal-6.16)

Modules and themes can modify theme variables such as $head using theme hooks:

MODULENAME_preprocess_page(&$variables)
THEMENAME__preprocess_page(&$variables)

Adaptivetheme itself doesn't modify the $head variable, but modules like Book do. You can implement a preprocess_page() function yourself in a subtheme or module.

For an example of how to add extra <link /> elements, see my Touch Icons module (touch_icons.module, line 388):

http://drupalcode.org/viewvc/drupal/contributions/modules/touch_icons/to...

Adding a <meta /> element can be done in a similar way. Note that the $variables array is passed by reference, so be careful not to over-write what is already there from other modules.

scotthoff’s picture

Thanks a lot. I don't really know what I am doing with this pre process variables. I am going to some research on what you are saying.

scotthoff’s picture

With the following code, I was able to add some text inside of $head, however, I was not sure if it overwrote what should have shown with nodewords.

Here is the code that I wrote to test...

function speakitnow_preprocess_page(&$vars, $hook) {
  $vars['sample_variable'] = t('Lorem ipsum.');
  if($vars['head']){
	$vars['head'] .= "test test test ";
  } else {
	$vars['head'] = "<meta name='keywords' content='HTML,CSS,XML,JavaScript' />";
  }
}
halcyonCorsair’s picture

You can also call drupal_set_html_head() in places like MODULENAME_init().

ie. drupal_set_html_head('');

scotthoff’s picture

Would that overwrite existing head text?

halcyonCorsair’s picture

Jeff Burnz’s picture

Status: Active » Closed (fixed)

Cleaning up the issue queue.