Im trying to get PHP to echo out something like
#myStyle0 {... left:0px; top:0px; ...}
#myStyle1 {... left:144px; top:0px; ...}
#myStyle2 {... left:0px; top:144px; ...}
#myStyle3 {... left:144px; top:144px; ...}
imagine that example as a 2x2 table. so if i wanted 4x2 it would do left 0, 144, 288, 432 etc
i have come up with this:
<?
$xPos = 144; // 144
$yPos = 104; // 104
$numberImages = 16;
$numberRows = ceil($numberImages/4); // four images per row, for example
// working out xPos
for($i=0;$i<4;$i++){
echo '#myStyle'. $i .' {... left:' .$xPos*$i. '; ...}' . "\n";
}
// working out yPos, based on number of rows
for($i=0;$i<$numberRows;$i++){
... ... ... ... ... ...
}
?>
i do not know how to, so to speak, merge the two together so they come out looking like proper CSS. if anyone could help thanks.
#myStyle0 {... left:0px; top:0px; ...}
#myStyle1 {... left:144px; top:0px; ...}
#myStyle2 {... left:0px; top:144px; ...}
#myStyle3 {... left:144px; top:144px; ...}
imagine that example as a 2x2 table. so if i wanted 4x2 it would do left 0, 144, 288, 432 etc
i have come up with this:
<?
$xPos = 144; // 144
$yPos = 104; // 104
$numberImages = 16;
$numberRows = ceil($numberImages/4); // four images per row, for example
// working out xPos
for($i=0;$i<4;$i++){
echo '#myStyle'. $i .' {... left:' .$xPos*$i. '; ...}' . "\n";
}
// working out yPos, based on number of rows
for($i=0;$i<$numberRows;$i++){
... ... ... ... ... ...
}
?>
i do not know how to, so to speak, merge the two together so they come out looking like proper CSS. if anyone could help thanks.