Ok, I have these 2 types of layouts, basically, it can be any layout really. I have decided to use tables for this, since using div tags cause undesirable results in some possible layout types.
Here are 2 pics that describe the returned results of row and column:
This would return the $layout array like so:
$layout[0][0]
$layout[0][1]
$layout[1][1]
In this layout type: $layout[1][0] is NOT SET, or doesn't exist. Row 1, Column 0 doesn't exist in here. So how can we use this to help us determine the rowspans...?
Ok, this layout type would now return the following:
$layout[0][0]
$layout[0][1]
$layout[1][0]
$layout[2][0]
$layout[2][1]
$layout[3][1]
Again, there are some that are NOT SET in here:
$layout[1][1]
$layout[3][0]
Ok, I have an array called $layout that does a foreach on the row and column, but it doesn't grab the rows and columns that are NOT SET. So I created a for loop (with the correct counts of how many rows there are and how many columns there are). Here's what I got so far:
// $not_set = array();
for($x = 0; $x < $cols; $x++)
{
$f = 0;
for($p = 0; $p < $rows; $p++)
{
// $f = count($layout[$p]);
if(!isset($layout[$p][$x]))
{
$f++;
// It could be a rowspan or a Colspan...
// We need to figure out which 1 it is!
/*
$not_set[] = array(
'row' => $p,
'column' => $x,
);
*/
}
// if ($rows - count($layout[$p]))
}
}
Ok, the $layout array has 2 keys. The first 1 is [ row ] and the 2nd key is [ column ].
Now looping through them all and determining whether it's NOT SET, tells me that either a rowspan or a colspan needs to be put into something somewhere. I'm completely lost here.
Basically, I would like to have an array returned here, something like this:
$spans['row'][ row # ][ column # ] = Number of rowspans for that <td> element.
$spans['column'][ row # ][ column # ] = Number of colspans for that <td> element.
It's either going to need a colspan or a rowspan, it will definitely never need both for the same element.
Am I going about this whole thing the wrong way? Any help at all would be greatly appreciated!! I've been driving myself crazy with this for days! Pllleaase...