I need to add the following code as a preprocess function. I can add it verbatim to template.php and it works just perfectly. However, it appears that the preferred way of handling this in Omega is to create a preprocess-xxx.inc file and include the function there. But I'm stuck.

Do I create preprocess-html.inc, preprocess-page.inc, preprocess-node.inc?

And what do I include in that file?

Here's the code:

function YOURTHEME_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;
      }
    }
  }
}

The purpose of the code is to load a custom html--nodealias.tpl.php file so that I can add code to the head and prior to the closing body tags.

Comments

Cellar Door’s picture

If you want to add code to the head and closing why not just copy/paste the html.tpl.php from the core omega/templates into your subtheme/templates you can add the code you want to there and not have to mess w/ the preprocess functions.

Cellar Door’s picture

Status: Active » Fixed
Cellar Door’s picture

Status: Fixed » Active

sorry wrong post..... if you still want help w/ a preprocess function let us know. Otherwise you can declare fixed yourself