Authored by tmq

右边banner

... ... @@ -75,14 +75,14 @@
</a>
</li>
EOL;
// $groupLen ++;
// if($groupLen>= 8)
// {
// $templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
// $html = '';
// $groupLen = 0;
// $groupNum = 0;
// }
$groupLen ++;
if($groupLen>= 8)
{
$templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
$html = '';
$groupLen = 0;
$groupNum = 0;
}
}
if(!empty($html))
{
... ... @@ -153,19 +153,18 @@ EOL;
$banners = $this->view->rightBanners;
$temp = array();
$len = count($banners);
if($len >=3 && is_numeric($len)&($len&1))
if($len >=3)
{
$temp = array_slice($banners, 0, 1);
$pos = rand(1, $len-1);
$banners = array_merge($temp, array_slice($banners, $pos, 1));
}
if($len >3 && is_numeric($len)&(!($len&1))){
//$banners=array_chunk($banners,2);
$temp = array_slice($banners, 0, 1);
$pos = rand(1, $len-1);
$banners = array_merge($temp, array_slice($banners, $pos, 1));
//随机选择出两个元素
$temp=array_rand($banners,2);
foreach($temp as $val){
$data_last[]=$banners[$val];
}
// $temp = array_slice($banners, 0,1);
// $pos = rand(1, $len-1);
// $banners = array_merge($temp, array_slice($banners, $pos, 2));
}
foreach($banners as $banner):
foreach($data_last as $banner):
$res_size = json_decode($banner['res_size'], true);
if($res_size['height'] < 308 && $res_size['width']< 308)
{
... ...