Hovertips and Views simple list

mkrakowiak - August 25, 2008 - 21:57
Project:Hovertips and Clicktips
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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:

<?php

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.

#1

mkrakowiak - August 26, 2008 - 17:48

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

#2

Dave Cohen - August 27, 2008 - 07:21
Status:active» fixed

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

#3

mkrakowiak - August 27, 2008 - 12:26

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

#4

Anonymous (not verified) - September 11, 2008 - 05:33
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.