When building a table using HtmlHelper, is there any way to add an attribute such as an ID to all <tr> rows?
e.g. This is a simplified version of my current <tbody> code:
foreach ($subjects as $subject) {
echo $this->Html->tableCells(
array(
$subject['Subject']['id'],
$subject['Subject']['name']
),
array('class' => 'odd'), null, true
);
}
I want to have the table come out something like:
<tr id="subj-34"><td ...
<tr id="subj-263"><td ...
<tr id="subj-11"><td ...
Took me while to realize this was a simpler case than I first thought. You can just add the id attribute to the second and third parameters (so that it applies to both even and odd rows).