I'm working on a rather heavily themed view for a "portfolio" section of a new site. There are a few different vocabularies (with many terms in each) by which each item is categorized, and for the sake of design control, I've decided to use simple Drupal menus for filtering rather than exposed Views forms. The first thing I tried is adding a new region to my site theme's .info file, creating a new menu, adding the block to my new region, and then using print $newregion; in my customized Views theme template. However, that PHP doesn't seem to do anything there. Is there any way to get Drupal/Views to pass $newregion down to my Views theme files, or is that not within the scope ?

To clarify a bit more, here's the code I'm using in my custom views-view-fields--portfolio--page.tpl.php:

<div id="portfolio-single">
  <div id="portfolio-image"><?php print $fields['iid']->content; ?></div>
  <div id="portfolio-details">
    <div id="portfolio-menu">
      <?php print $newregion; ?> // <----- This is where I'd like my menu block to appear.
    </div>
  <div id="portfolio-text">
	<div id="portfolio-title"><?php print $fields['title']->content; ?></div>
	<div id="portfolio-body"><?php print $fields['body']->content; ?></div>
  </div>
</div>

My backup option is to print the region normally in page.tpl.php (after print $content, where the view has printed completely) and then "position: relative;" it into place, but I'd like to avoid that kind of solution if possible, since it can be inconsistent, especially with dynamic content above it.

Any ideas? Or am I just completely misunderstanding the Drupal theming system and approaching this the wrong way?

Comments

dawehner’s picture

Status: Active » Fixed

you can render a region by using this

<?php
$newregion = theme('blocks', $regioname);
?>
peterjmag’s picture

Perfect! For documentation's sake: I ended up using print theme('blocks', 'portfoliomenu'); ('portfoliomenu' being the name of the region I added in my theme's .info file)

Thanks dereine for your insanely quick response!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sheanhoxie’s picture

I was having a similar problem within Drupal 5 template.php while overriding a theme function for the FAQ module.

I couldnt print the region using the method above, but was able to add the region using this...

  $output .= "<div id=\"help-body-right\">";

  $output .= theme('blocks', 'name_of_region');

  $output .= "</div>\n";