Render a Views row ID using NID (Node ID) I can easily add NID (Node ID) as a field in my view and then render it as a class for the Views Row using replacement patterns for the row class of an unformatted typical view. (See screen capture). 



However, I'd like to render the NID as an ID for each row for use for some special theming I am doing. If I use devel themer, I see my template is views-view-unformatted.tpl.php so I can of course copy this template into my theme's template folder with a custom name specific to my view and then theme it. 

The relevant line of code in the template that renders the row class is:

  &lt;div&lt;?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?&gt;&gt;


If I change it to:

&lt;div&lt;?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?&gt; 
    id="&lt;?php print $fields['nid']-&gt;content ?&gt;"&gt;


...However, this does not work as I don't think fields are available at this level in the views row. 

So essentially right now my rendered output is:

&lt;div class="views-row views-row-1 views-row-odd views-row-first mynid-63"&gt;
&lt;div class="views-row views-row-2 views-row-even mynid-64"&gt;


... when I'd like it to be

&lt;div class="views-row views-row-1 views-row-odd views-row-first" id="mynid-63"&gt;
&lt;div class="views-row views-row-3 views-row-even" id="mynid-64"&gt;


My question, is there a way to just render the associated NID where I want it as an id other then the method I am trying to use?
In most Views templates, the entire $view object is available.  So, assuming you have a nid field in the row, you should be able to access it with something like this:

$view-&gt;result[$id]-&gt;nid


so, give

id="my-nid-is-&lt;?php print $view-&gt;result[$id]-&gt;nid; ?&gt;"&gt;


a try in your template.

If this doesn't work exactly, a print_r($view-&gt;result); up at the top of the template will give you a gander at what you have to work with.