steve
steve

Reputation: 1

drupal 7 adding custom cck field in html.tpl.php head

I need to add a custom base href, I have a organic groups multisite setup. I have a field field_site_url which renders the URL correctly how would I get this to print

I did this but it doesnt work base href="what do i put here" target="_blank"

Any ideas please Thanks

Upvotes: 0

Views: 816

Answers (1)

Viz
Viz

Reputation: 31

I get CCK / fields data into html.tpl.php in d7 by using a preprocess function in template.php:

function THEMENAME_preprocess_html(&$variables, $hook) {
 $node = menu_get_object();
  if($node)
  {
     $variables['myfield'] = $node->field_myfield['und'][0]['value'];
  }
}

This sets up a $myfield variable you can output in html.tpl.php :

echo $myfield;

Upvotes: 3

Related Questions