I am attempting to add a page-[front|internal/path].tpl.php suggestion to a rubik subtheme and I cannot figure out why it does not work.

I've added the templet suggestion in the same location as the base (not in the templates folder), as well as in the parent theme (rubik)
I have tried using the page-node-#.tpl.php to avoid an error with the path.
template suggestions do work for node.tpl.php

I need a particular set of nodes without the header and footer
I don't know if this is by design from a tao theme change which is why this is a support request not a bug request.

Thanks

Comments

Nathan005’s picture

tried adding this to my template.tpl.php

function theme_preprocess_page(&$vars) {
  
  if (module_exists('path')) {
    $alias = drupal_get_path_alias(str_replace('/edit','',$_GET['q']));
    if ($alias != $_GET['q']) {
      $suggestions = array();
      $template_filename = 'page';
      foreach (explode('/', $alias) as $path_part) {
        $template_filename = $template_filename . '-' . $path_part;
        $suggestions[] = $template_filename;
      }
    }
    $vars['template_files'] = $suggestions;
  }
 return $vars;
}

it works but it breaks something else

I'm using the context module - I have it switching the layout from 1-3 column layouts
the layouts still appear properly but the blocks and their content assigned to the sidebars do not.
I would still prefer to find a better solution to my first issue, don't know if I'm on the right track or not.

Nathan005’s picture

ok well that explains it.

function rubik_preprocess_node(&$vars) {
  $vars['layout'] = TRUE;
  $vars['title'] = menu_get_object() === $vars['node'] ? '' : $vars['title'];
  $vars['attr']['class'] .= ' clear-block';

  // Clear out template file suggestions if we are the active theme.
  // Other subthemes will need to manage template suggestions on their own.
  global $theme_key;
  if (in_array($theme_key, array('rubik', 'cube'), TRUE)) {
    $vars['template_files'] = array();
  }
}

I figure I can get this to work with the context module if I can define a new layout
I did this before but I don't remember how - any insight?

Nathan005’s picture

ahh that did it

add the layout in the info file and apply it via context
I love the concept wish it was a little better documented.

Hopefully later this helps someone else

Nathan005’s picture

Status: Active » Closed (fixed)
3rdLOF’s picture

Man, I am as lost with Rubik as a bull in a China shop. Can you just extent your explanation on this last entry a bit further. I am on D7 and not building a subtheme, just trying to modify Rubik, but none of my template suggestions seem to work.

Thanks.

fupduck’s picture

I guess this is a little late, but i had the same problem.

In your theme.info file you have to add a new layouts section (there should be some in there that you can use as examples. If not - I'll append one.
Then make sure the modules "context" and "context layouts" are activated. In your admin section there should be a link "context". Add a new context, add necessary conditions (i.e. path to site) and select in reaction "blocks" and there your custom layout.

Hope this helps.

Layout-Example:

layouts[offset][name] = "Offset sidebars"
layouts[offset][description] = "Main content with two offset sidebars."
layouts[offset][stylesheet] = "layout-offset.css"
layouts[offset][template] = "layout-offset"
layouts[offset][regions][] = "header"
layouts[offset][regions][] = "content"
layouts[offset][regions][] = "left"
layouts[offset][regions][] = "right"