I wanted to present a range of choices in a nicely formatted table and couldn’t see helper to do the job – so this is my first snippet for Cake PHP. I doubt it’s perfectly cake (for instance I do the header row myself rather than using the html helper, and I concatenate a string rather than building an array)
In this instance I added the function radioTable to a helper called “fed” and gave it the standard model and field variables.
foreach ($options as $holder)
{
if (count($holder)>1)
{
$thisItem = $thisHolder = array();
foreach($holder as $toMerge) $thisItem = array_merge($thisItem, $toMerge);
$thisHolder[] = $thisItem;
}
else $thisHolder = $holder;
foreach ($thisHolder as $item)
{
$keys = array_keys($item);
if (is_array($item[$keys[0]]))
{
$thisItem = array();
foreach($item as $toMerge) array_merge($thisItem, $toMerge);
// will have changed so need to rework
$keys = array_keys($thisItem);
}
else $thisItem = $item;
how you use this example I can not set it up