digitalDave
Member
Hope someone with more experience than me can help this amateur.
I am trying to create a custom template.
I have a form with several tabs on it.
On one of these tabs there are 24 elements.
For the 5th,10th,15th and 20th element I want to change the table heading to span 4 elements. Then I can hide the others in CSS.
If I change this in a copied default_repeat_group_table.php
To this
It changes all my headings to span 4 as you would expect.
I assume that I need to test for the group and then test for the element with IF , but if I'm honest I don't really have a great grasp of PHP.
I could write an IF to select a variable of 4 or 1 depending on element and group, but I don't understand how to use that result?
I referred to this
Thank you Rob great video.
I am trying to create a custom template.
I have a form with several tabs on it.
On one of these tabs there are 24 elements.
For the 5th,10th,15th and 20th element I want to change the table heading to span 4 elements. Then I can hide the others in CSS.
If I change this in a copied default_repeat_group_table.php
Code:
// Add in the table heading
$firstGroup = $group->subgroups[0];
foreach ($firstGroup as $el) :
$style = $el->hidden ? 'style="display:none"' : '';
?>
<th <?php echo $style; ?> class="<?php echo $el->containerClass?>">
<?php echo $el->label_raw?>
</th>
<?php
endforeach;
To this
Code:
// Add in the table heading
$firstGroup = $group->subgroups[0];
foreach ($firstGroup as $el) :
$style = $el->hidden ? 'style="display:none"' : '';
?>
<th colspan= "4" <?php echo $style; ?> class="<?php echo $el->containerClass?>">
<?php echo $el->label_raw?>
</th>
<?php
endforeach;
It changes all my headings to span 4 as you would expect.
I assume that I need to test for the group and then test for the element with IF , but if I'm honest I don't really have a great grasp of PHP.
I could write an IF to select a variable of 4 or 1 depending on element and group, but I don't understand how to use that result?
I referred to this