Hi,
I have a list of titles displayed in a block View and using the Hovertip module I want to display (in a tooltip) teasers associated with the titles in this block. So, using views theme wizard, I added the function to my template.php file:

function phptemplate_views_view_list_recent_blog_posts($view, $nodes, $type) {
  $fields = _views_get_fields();

  $taken = array();

  // Set up the fields in nicely named chunks.
  foreach ($view->field as $id => $field) {
    $field_name = $field['field'];
    if (isset($taken[$field_name])) {
      $field_name = $field['queryname'];
    }
    $taken[$field_name] = true;
    $field_names[$id] = $field_name;
  }

  // Set up some variables that won't change.
  $base_vars = array(
    'view' => $view,
    'view_type' => $type,
  );

  foreach ($nodes as $i => $node) {
    $vars = $base_vars;
    $vars['node'] = $node;
    $vars['count'] = $i;
    $vars['stripe'] = $i % 2 ? 'even' : 'odd';
    foreach ($view->field as $id => $field) {
      $name = $field_names[$id];
      $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
      if (isset($field['label'])) {
        $vars[$name . '_label'] = $field['label'];
      }
    }
    $items[] = _phptemplate_callback('views_list_recent_blog_posts', $vars, array('views-list-recent_blog_posts'));
  }
  if ($items) {
    return theme('item_list', $items);
  }
}
 

and also created a tpl.php file with this code:

<div class="view-label view-field-title">
  <?php print $title_label ?>
</div>
<div class="view-field view-data-title"><span hovertip="text">
  <?php print $title?></span>
</div>
<div class="hovertip" id="text" style="background-color:#DDD;">
  <?php $teaser = _nodeteaser_teaser($node); print $teaser ?>
</div>

I'm using the css from http://www.johnandcailin.com/blog/cailin/better-css-drupal-hovertip-module

I have it working... well - partially. When hovered, all the titles display the teaser from the last title on the list. If anyone knows how to fix it, it would be great.

Comments

mkrakowiak’s picture

I found a module (views popup) that does exactly what I want here, so I won't be pursuing this issue anymore.

Dave Cohen’s picture

Status: Active » Fixed

Glad you found a solution. Thanks also to the pointer to that post about CSS. I had not seen that before.

mkrakowiak’s picture

Yeah, I think it may be worth including the URL in the module documentation.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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