Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 1059 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding custom code to <head> in Drupal

#1
I'm trying to figure out where the `<head>` for all of the pages in Drupal is (I'm using Orange theme if it matters). I have to add analytics code into the `<head>`.

Inside which file would I find the `<head>`?
Reply

#2
[How to change a page meta description and keywords in Drupal 6][1]


[1]:

[To see links please register here]

Reply

#3
there is a google analyitics module that will accomplish this for you with just your key.
Reply

#4
One another solution is to use blocks in header these can also managed very effectively using css.

1. All you have to do is to go to Structure->Blocks then create new block.

2. Then select theme corresponding to it and position in which section you want to show that block.

3. Custom html like <div id="block-in-header"></div> can be added. And can be handled from that id.

It allow me to handle page structure very easily.
Reply

#5
If you look in your theme folder you'll see `page.tpl.php`, that is the template for the site. You can add the code there most likely.
Reply

#6
Use [`drupal_set_html_head()`][1] by placing this in your themes *template.php* file. If the function `MYTHEMENAME_preprocess_page()` already exists insert what is inside the `{`closure`}` brackets below (before the `$vars['head']` if that exists in it as well) :

function MYTHEMENAME_preprocess_page(&$vars, $hook) {
// say you wanted to add Google Webmaster Tools verification to homepage.
if (drupal_is_front_page()) {
drupal_set_html_head('<meta name="google-site-verification" content="[string from https://www.google.com/webmasters/verifi...tion]" />');
$vars['head'] = drupal_get_html_head();
}
}

[1]:

[To see links please register here]

Reply

#7
In *template.php* of your theme folder :

function your_theme_preprocess_html(&$variables) {

$appleIcon57px = array(
'#tag' => 'link',
'#attributes' => array(
'rel' => 'apple-touch-icon',
'href' => '/images/ICONE-57.png',
'type' => 'image/png',
'media' => 'screen and (resolution: 163dpi)'
)
);
drupal_add_html_head($appleIcon57px, 'apple-touch-icon57');
}
Reply

#8
In the *theme folder* (e.g. `themes/orange`) there is a `templates` folder with the file `html.tpl.php`

In this file you can freely add what you need to the `head` section and it will be added to every page.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through