hi all!

sorry for my english...

I have the function by default inside my template.tpl.php of my theme > corporate:

<?php
function corporate_preprocess_page(&$vars) {
  if (isset($vars['main_menu'])) {
    $vars['main_menu'] = theme('links__system_main_menu', array(
      'links' => $vars['main_menu'],
      'attributes' => array(
        'class' => array('links', 'main-menu', 'clearfix'),
      ),
      'heading' => array(
        'text' => t('Main menu'),
        'level' => 'h2',
        'class' => array('element-invisible'),
      )
    ));
  }
  else {
    $vars['main_menu'] = FALSE;
  }
  if (isset($vars['secondary_menu'])) {
    $vars['secondary_menu'] = theme('links__system_secondary_menu', array(
      'links' => $vars['secondary_menu'],
      'attributes' => array(
        'class' => array('links', 'secondary-menu', 'clearfix'),
      ),
      'heading' => array(
        'text' => t('Secondary menu'),
        'level' => 'h2',
        'class' => array('element-invisible'),
      )
    ));
  }
  else {
    $vars['secondary_menu'] = FALSE;
  }
}
?>

If I add a function for theming page.tpl.php I get an error.

I want to insert the new code within the existing function ... you can help me in this?

This is the function to add:

<?php
function corporate_preprocess_page(&$variables) {
  if (isset($variables['node']) && arg(2) != 'edit' && arg(1) != 'add') {
    $variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type;
  }
}
?>

Best Regards...

Comments

nevets’s picture

Change the bottom of the existing function

  else {
    $vars['secondary_menu'] = FALSE;
  }
}

to

  else {
    $vars['secondary_menu'] = FALSE;
  }

  if (isset($variables['node']) && arg(2) != 'edit' && arg(1) != 'add') {
    $variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type;
  }
}
kipper’s picture

Many Tanks!

I have another thing to solve ... the thread title is fine and then write it here...

template.tpl.php

function:

<?php
function corporate_preprocess_html(&$vars) {
  // Add body classes for custom design options
  $colors = theme_get_setting('color_scheme', 'corporate');
  $classes = explode(" ", $colors);
  if (!theme_get_setting('backgroundimg', 'corporate')){
    $vars['classes_array'][] = 'nobkimg';
  }
  for($i=0; $i<count($classes); $i++){
    $vars['classes_array'][] = $classes[$i];
  }
}
?>

function/code to add:

<?php
function corporate_preprocess_html(&$vars) {
  $node = menu_get_object();

  if ($node && $node->nid) {
    $vars['theme_hook_suggestions'][] = 'html__' . $node->type;
  }
}
?>

is for theming > html.tpl.php - html--myctype.tpl.php etc etc...

I will try to understand the logic of these changes

Thank you very much

kipper’s picture

ok... I find a solution!

<?php
function corporate_preprocess_html(&$vars) {
  $node = menu_get_object();
  if ($node && $node->nid) {
    $vars['theme_hook_suggestions'][] = 'html__' . $node->type;
  }
  // Add body classes for custom design options
  $colors = theme_get_setting('color_scheme', 'corporate');
  $classes = explode(" ", $colors);
  if (!theme_get_setting('backgroundimg', 'corporate')){
    $vars['classes_array'][] = 'nobkimg';
  }
  for($i=0; $i<count($classes); $i++){
    $vars['classes_array'][] = $classes[$i];
  }
}
?>

More Thanks...

gausarts’s picture

Change $variables to $vars, or vice versa accordingly.

love, light n laughter

kipper’s picture

Great! work fine!!!

Thanks to both of you!