<?php
//首页新闻列表生成 {ls_news}  2468  ls-syscode

$news = "";
		$nui = 0;
		if($mainpartsubject!="index_m"){
				$news_sql="select * from ls_news where cate = '".$news_cate_rows3['cateName']."' and enable=1 order by Num desc limit 0, 6";
				$news_query=$opendb->query($news_sql);
				while($news_rows=mysql_fetch_assoc($news_query)){
					//$nui ++;
				$suffix_str2 = $suffix_str2==""?$news_rows['cate']:$suffix_str2;
				if( !$suffStrlist || $suffix_str2 =="news" ){
					if(strpos($news_rows['newsText'], "<img") !== false){
							$newsImgStr=getStrbyTag("<img ","/>",$news_rows['newsText']);
							
							$imgHeight=getStrbyTag('height="','" ',$newsImgStr,false);
							$imgWidth=getStrbyTag('width="','" ',$newsImgStr,false);
							$newsImg=getStrbyTag('src="','" ',$newsImgStr);
							$newsImg = str_replace('../','',$newsImg);
							$srcImg = getSubstr($newsImg,"src=\"",'"');
							$srcImg = strtolower(getSubstr($newsImg,'src="','"'));  //变小写，清除 src= " 等
							$srcImg = str_replace('src=','',$srcImg);
							$srcImg = str_replace('"','',$srcImg);
							
							$proportion = $imgWidth/$imgHeight;
							
							if($proportion > (191/144)){
								$proportion = "width='".($proportion*144)."' height='144' ";
							}else{
								$proportion = " width='191' height='".(191/$proportion)."' ";
							}
							
							$news .= "<div class=\"col-lg-6 col-md-6 col-sm-12 col-xs-12 a1\">
   <div class=\"bbj\"><div id=\"hyl\"><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\"><img ".$newsImg." /></a>
								</div>
					<div id=\"hyr\">
						<h4><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\">".$news_rows['newsTitle']." </a></h4>
								  <p><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\">".mb_substr(strip_tags($news_rows['newsText']),0,500, 'utf-8')."</a></p>
								</div></div></div>";
						}else{
							$news .= "<div class=\"col-lg-6 col-md-6 col-sm-12 col-xs-12 a1\">
   <div class=\"bbj\"><div id=\"hyl\"><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\"><img src=\"images/demo.jpg\" width=\"191\" height=\"144\" /></a></div>
							<div id=\"hyr\">
						<h4><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\">".$news_rows['newsTitle']." </a></h4>
							  <p><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\">".mb_substr(strip_tags($news_rows['newsText']),0,500, 'utf-8')."</a></p>
							</div></div></div>";
						}
					}else{
					 	$news.="<li><span style='float:right;'>(".$news_rows['newsDate'].")</span><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\">".$news_rows['newsTitle']." </a>";
					 	$news.="</li>";
					}
	
				}
				$news.="</ul>";
			}else{
				 
			}
?>
