Show node title in block view?

chellman - May 30, 2007 - 01:14
Project:Views
Version:5.x-1.5
Component:Views Data
Category:support request
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

I've created a view that pulls the most recent video node and displays it in a block. This facilitates a "Featured Recent Video" function. It works great, except that I can't set the title of the block to the title of the video node. Or if it's possible, I haven't figured out how to do it.

The closest I got ended up changing the page title, which I want to stay the same. Here's the function from my template.php file:

<?php
function phptemplate_views_view_nodes_Featured_Video($view, $nodes, $type, $teasers = false, $links = true) {
 
// keep old page title
 
$old_title = drupal_get_title();

  foreach (
$nodes as $n) {
   
$node = node_load($n->nid);
   
$output .= node_view($node, $teasers, true, $links);
  }

 
// reset the title
 
drupal_set_title($old_title);
  return
$output;
}
?>

Is there something I can do here to make $node->title available to this block?

Random Note: I'm setting $page to true in node_view because otherwise the video player isn't displayed.

#1

sun - September 19, 2008 - 04:48
Status:active» won't fix

Sorry, unfortunately this support request is way too specific. Please have a look at the issue queue - Views maintainers are buried already. You might want to try to get further support at http://drupal.org/support.

 
 

Drupal is a registered trademark of Dries Buytaert.