mike karthauser gave the correct solution.
The foreach loop should be built to handle any numbers of rows, as it
already does, and then you should do conditional checks within the
loop to know if there are 1, 2 or 3 values in each row, presumably
echoing some alternative content/code for empty values.
I would go for the following with a check to see if the skills array
exists and has rows and would use the shorthand echo if else statement
to but an empty/blank value for empty values.
<?php
if(!empty($skills)):
<div class='single'>
foreach():
<div class='trio'>
<?php echo isset($skill[0]) ? $skill[0] : 'empty'; ?>
<?php echo isset($skill[1]) ? $skill[1] : 'empty'; ?>
<?php echo isset($skill[2]) ? $skill[2] : 'empty'; ?>
</div>
endforeach;
</div>
endif(!empty($skills));
?>
I only just noticed you are echoing fieldset tags. Is this a form you
are echoing out as that would be the only valid reason to use
fieldsets? If so, it is likely that you are manually writing logic
that the form helper can do on your behalf.
HTH
Paul.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en