I am having some trouble assigning my own array key to the below code. It works fine for the col and it appears from low to high but not the rows! I can't quite get my head around it. The row items are grouping together but not in the correct order (row 3 and 4 are appearing the wrong way round)
if (isset($blogsArr[$bid]->imgurl)){
$imghtml = 'style="background-image:url('.$blogsArr[$bid]->imgurl.');" data-imgurl="'.$blogsArr[$bid]->imgurl.'"';
}
if (isset($blogsArr[$bid])){
$dbRow=$blogsArr[$bid]->row;
$html[$dbRow][$blogsArr[$bid]->col] = '<li data-row="'.$blogsArr[$bid]->row.'" data-col="'.$blogsArr[$bid]->col.'" data-sizex="'.$blogsArr[$bid]->size_x.'" data-sizey="'.$blogsArr[$bid]->size_y.'" data-type="blog" data-blogid="'.$bid.'" class="blog-box blog-id-'.$bid.'">';
$html[$dbRow][$blogsArr[$bid]->col] .= '<input class="box-pid" type="hidden" value="'.$bPid.'">';
$html[$dbRow][$blogsArr[$bid]->col] .= '<div class="boxbg" '.$imghtml.'></div>';
$html[$dbRow][$blogsArr[$bid]->col] .= '<h2>';
$html[$dbRow][$blogsArr[$bid]->col] .= '<a href="'.$pURL.'" style="color:'.$tcolor.';">';
$html[$dbRow][$blogsArr[$bid]->col] .= ucfirst ($site['title']);
$html[$dbRow][$blogsArr[$bid]->col] .= '</a></h2>';
// Article title overlay
$html[$dbRow][$blogsArr[$bid]->col] .= '<div class="article-overlay">';
$html[$dbRow][$blogsArr[$bid]->col] .= '<a href="'.$pURL.'" class="ao-link">Article Title</a>';
$html[$dbRow][$blogsArr[$bid]->col] .= '<a href="'.$pURL.'" class="ao-view"><span>VIEW ARTICLE</span></a>';
$html[$dbRow][$blogsArr[$bid]->col] .= '</div>';
$html[$dbRow][$blogsArr[$bid]->col] .= '</li>';
}
else {
$html .= '<li data-row="1" data-col="1" data-sizex="1" data-sizey="1" data-type="blog" data-blogid="'.$bid.'" class="blog-box blog-id-'.$bid.'"><input class="box-tcolor" type="hidden" value="'.$tcolor.'"><input class="box-pid" type="hidden" value="'.$bPid.'"><div class="boxbg" '.$imghtml.'></div><h2 style="color:'.$tcolor.';">' . ucfirst ($site['title']).'</h2></li>';
}
}
if (isset($adsArr)){
foreach ( $adsArr as $ad ) {
$html[$ad->row][$ad->col] = '<li data-row="'.$ad->row.'" data-col="'.$ad->col.'" data-sizex="'.$ad->size_x.'" data-sizey="'.$ad->size_y.'" class="advert-box" data-blogid="'.$ad->blogid.'" data-type="ad" data-max-sizex="'.$ad->size_x.'" data-max-sizey="'.$ad->size_x.'" data-min-sizex="'.$ad->size_x.'" data-min-sizey="'.$ad->size_x.'"></li>';
}
}
sort($html);
$ii=0;
// Sort the cols
foreach($html as $ht) {
sort($ht);
$html[$ii]=$ht;
$ii++;
}
return $html;
I have been looking at this article for reference http://www.homeandlearn.co.uk/php/php6p2.html
Any help would be greatly appreciated.
Thanks