1

It was suggested the below script in template.php might work to assist in creating a modified HTML page.

<?php
function YOUTHEME_preprocess_html (&$vars) {
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit','',$_GET['q']));
if ($alias != $_GET['q']) {
$template_filename = 'html';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '__' . $path_part;
$vars['theme_hook_suggestions'][] = $template_filename;
      }
    }
  }
}
?>

I tried it but broke my site. Do I need to copy just the code minus the php brackets? Use my exact subtheme name to replace YOURTHEME and then create my html--foo.tpl.php to correspond?

  • What are you trying to accomplish? – Lester Peabody Mar 18 '14 at 5:03
  • I am trying to customise a particular node with html that will not work in a block as such. – cea Mar 18 '14 at 5:14
0

you can try function themeName_preprocess_page(&$vars, $hook) to override theme theme_hook_suggestions. More detail you will find here.

  • PHP Fatal error: Cannot redeclare black_premium_html_head_alter() getting this now when changing template. I tried instructions on your link as well and it didn't break the site- just didn't work sorry. – cea Mar 18 '14 at 7:04
  • Why are you trying to redeclare any function? Use previously declared function to take effect as you want – Rupesh Mar 18 '14 at 7:12
  • Not trying to redeclare, that is just output error after modifying template.php command drush cc all – cea Mar 18 '14 at 8:15
  • Anyway this is more confusing for me because I'm not sure what I should leave in page--foo.tpl.php where it is mix of php code and html and page I need to embed is not even same doc type! – cea Mar 18 '14 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.