Community

how can i print NID in views-view.tpl.php

Hi people
I been working on a custom views for almost 12 hours and im stuck, i have one TINY change remaining i need to make and i cant figure it out.

For my view, i have a custom template file for views-view.tpl.php. The name of the file is views-view--reports-block--block.tpl.php (my view is called 'Reports Block').

You can see the code in that file below:

<?php

/**
* @file
* Default simple view template to display a list of rows.
*
* - $title : The title of this group of rows.  May be empty.
* - $options['type'] will either be ul or ol.
* @ingroup views_templates
*/
?>


<?php
$nid
= $view->nid;
print_r($nid);
?>


<?php print $wrapper_prefix; ?>
  <?php if (!empty($title)) : ?>
    <h3><?php print $title; ?></h3>
  <?php endif; ?>
  <div id="collapseOne" class="accordion-body collapse">
  <?php print $list_type_prefix; ?>
    <?php foreach ($rows as $id => $row): ?>
      <li class="<?php print $classes_array[$id]; ?>"><?php print $row; ?></li>
    <?php endforeach; ?>
</div>
  <?php print $list_type_suffix; ?>
<?php print $wrapper_suffix; ?>

Now the only thing i want to do is to replace "collapseOne" with the Node ID. Thats it. I have managed to do this in another template file using the code below, but it doesnt seem to work for this template file:

<?php $accordinnid = $row->nid; ?>

Any help would be much appreciated. Thanks

Comments

The code and the question do

The code and the question do not line up.

  <div id="collapseOne" class="accordion-body collapse">

would need to be inside
    <?php foreach ($rows as $id => $row): ?>

to have access to the row data.

Side note: are you aware of Views Accordion

omg i feel so stupid. there

omg i feel so stupid. there was a module for that?? goshh
thank u so much

nobody click here