How do I add a template suggestion for a node based on the current view? I have a view that lists a bunch of nodes of a certain content type. I want to style this list of nodes in a way that I can't do easily with the standard node.tpl.php that they're being rendered with. I'm trying to override my themename_preprocess_node function to add a template suggestion depending on what view the nodes were called from. I tried this:

&lt;?php
  function themename_preprocess_node(&amp;$variables) 
  {
    // Add theming based on view name. If the view is named 
    // 'featurefront' one of the template suggestions will be
    // 'node-view--featurefront.tpl.php'.
    if (isset($variables['view']))
    {
       $variables['theme_hook_suggestions'][] = 'node_view__'.
            str_replace('_', '--', $variables['view']-&gt;name);
    }
  }
?&gt;


but it doesn't work because $variables['view'] isn't ever set anywhere. Basically my question comes down to this: 

What variable can theme_preprocess_node use that will tell it the name of the current view or whether it was called from a view at all?
You can leverage the views_get_current_view() function to get the current view being rendered.  I haven't tested the code below, but it should get you close to what you are trying to do.  Note that it could have unintended consequences if nodes are being rendered somewhere else on the page.

function themename_preprocess_node(&amp;$variables)  {
  if (($view = views_get_current_view()) &amp;&amp; 'featurefront' == $view-&gt;name) {
    $variables['theme_hook_suggestions'][] = 'node_view__' . $view-&gt;name;
  }
}


Views doesn't set template variables for nodes, which is why the technique above has to be leveraged.