Custom regions not working?

Posts: 102
Joined: 01/11/2008

I'm using the UC Catalog and have created a custom node-product.tpl.php file where I used Nifty products example to customize the look of the product info page.

Not sure if I can do this with normal nodes but I tired creating a new region and inserted the call to the region in the node-product.tpl.php and then assigned a block to it. The block didn't show.

I then created a new page-product.tpl.php file too see if this would work but still no go.

So I inserted the call to the region in my default php.tpl.php file. This then work correctly but I could only insert the new block after all the content and comments.

Is there a way to call a new region into the node-product.tpl.php. I'm just trying to show the upsell products block below by products description.

Posts: 102
Joined: 01/11/2008

Well I found this on Drupal http://drupal.org/node/29139 Not sure if that code if for 4.7 only or 5

How do I combine the following with my template.php

This is from the above link

function _phptemplate_variables($hook, $variables) {
  // Load the node region only if we're not in a teaser view.
  if ($hook == 'node' && !$vars['teaser']) {
    // Load region content assigned via blocks.
    foreach (array('inline1') as $region) {
      $variables[$region] = theme('blocks', $region);
    }
  }
  return $variables;
}

This is that I have in template.php

function _phptemplate_variables($hook, $vars = array()) {
  switch ($hook) {
    case 'page':

      // Add page template suggestions based on the aliased path.
      // For instance, if the current page has an alias of about/history/early,
      // we'll have templates of:
      // page_about_history_early.tpl.php
      // page_about_history.tpl.php
      // page_about.tpl.php
      // Whichever is found first is the one that will be used.
      if (module_exists('path')) {
        $alias = drupal_get_path_alias($_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;
      }
      break;

    case 'node':

      // Add node template suggestions based on the aliased path.
      // For instance, if the current page has an alias of about/history/early,
      // we'll have templates of:
      // node_about_history_early.tpl.php
      // node_about_history.tpl.php
      // node_about.tpl.php
      // Whichever is found first is the one that will be used.
      if (module_exists('path')) {
        $alias = drupal_get_path_alias($_GET['q']);
        if ($alias != $_GET['q']) {
          $suggestions = array();
          $template_filename = 'node';
          foreach (explode('/', $alias) as $path_part) {
            $template_filename = $template_filename . '-' . $path_part;
            $suggestions[] = $template_filename;
          }
        }
        $vars['template_files'] = $suggestions;
      }
      break;
  }

  return $vars;
}

Thanks

Posts: 102
Joined: 01/11/2008

I got it sorted out on Drupal.org http://drupal.org/node/253922