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:
<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"'; } ?>>
If I change it to:
<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"'; } ?>
id="<?php print $fields['nid']->content ?>">
...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:
<div class="views-row views-row-1 views-row-odd views-row-first mynid-63">
<div class="views-row views-row-2 views-row-even mynid-64">
... when I'd like it to be
<div class="views-row views-row-1 views-row-odd views-row-first" id="mynid-63">
<div class="views-row views-row-3 views-row-even" id="mynid-64">
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?