0
votes

i am trying to create a page template in drupal 7 for my custom content type. I modified my theme_preprocess_page function to include a snippet of code to load it. It seems to work fine and my page--wine.tpl.php gets loaded. However drupal still renders a whole lot of tags in the head tag which I do not need. How can I remove it?

if (isset($vars['node'])) {
    // If the node type is "blog_madness" the template suggestion will be "page--blog-madness.tpl.php".
    $vars['theme_hook_suggestions'][] = 'page__'. $vars['node']->type;

  }

When the page is rendered it has a whole lot of junk html in the head tag. I am implementing a landing page for client. This landing page has completely separate html/assets and including css and javascript from the main template page is causing all sorts of issues. Is there a way to tell template engine not to render the Head tag if its my custom content type?

Perhaps there is a better way to implement landing pages in Drupal 7? I am new to Drupal so not sure!

Any help is greatly appreciated!

Thanks.

1

1 Answers

0
votes

Drupal builds the page by composing many template levels. Starting from html.tpl.php, and then page.tpl.php and then node/view templates.

If you override page.tpl.php html.tpl.php is still used. You have to override it too somehow.

Other way would be creating independent file - just make simple php file, include drupal's bootstrap and you'll have totally clear situation - no drupal's junk code, but you'll be able to use drupal's functionality like loading nodes and getting field values, printing them out..

So, make php file, place it in website root and be sure it starts with this code:

<?php

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);