我基本上写完了,现在拿出来和大家共享。不过php写的。希望大家参考.再一次谢谢大家的支持 //********************************************************************* // 测试阶段模块 //*********************************************************************//首页显示新闻列表模块 function news_b($read,$bid,$cid,$lenth,$lenth_height) { //如果小类没有资料,将显示所在大类的全部信息 if ($cid==""){ //$cid=""; $one="select * from news inner join two_class on news.two_class_id=two_class.two_class_id where news.class_top_id=".$bid." and news.isshow=1 and two_class.two_class_show=1 order by news.news_order desc "; }else{ $one="select * from news inner join two_class on news.two_class_id=two_class.two_class_id where news.class_top_id=".$bid." and news.two_class_id=".$cid." and news.isshow=1 and two_class.two_class_show=1 order by news.news_order desc "; } $query=mysql_query($one); $num=mysql_num_rows($query); $l=0; if ($num==0) { echo "没有此类新闻内容!"; }else{
·汽车| 伊兰特样车惊现 戴-克合并案恩怨
·汽车| 金弋波直面尴尬重组奇瑞难
·热点| 3980 奔四扛回家:神舟新梦1830H 看到这样的结构了吗。再循环出现汽车的同时,后边的链接是一条或着多条不同的 。该如何实现
//*********************************************************************
// 测试阶段模块
//*********************************************************************//首页显示新闻列表模块
function news_b($read,$bid,$cid,$lenth,$lenth_height)
{
//如果小类没有资料,将显示所在大类的全部信息
if ($cid==""){
//$cid="";
$one="select * from news inner join two_class on news.two_class_id=two_class.two_class_id where news.class_top_id=".$bid." and news.isshow=1 and two_class.two_class_show=1 order by news.news_order desc "; }else{
$one="select * from news inner join two_class on news.two_class_id=two_class.two_class_id where news.class_top_id=".$bid." and news.two_class_id=".$cid." and news.isshow=1 and two_class.two_class_show=1 order by news.news_order desc ";
}
$query=mysql_query($one);
$num=mysql_num_rows($query);
$l=0;
if ($num==0) {
echo "没有此类新闻内容!";
}else{
//循环显示所有内容
for ($i=0;$i<$num;$i++)
{ $row=mysql_fetch_array($query);
$news_id=$row['news_id'];
$ccid=$row['two_class_id'];
$color=$row['color'];
$two_color=$row['two_class_color'];
$two_url=$row['two_class_url'];
$str=$this->get_two_name($ccid);
//初始化变量。$K来判断是否取得的ID等于上一次的ID,如果不是,将置空基本信息。
if ($k!=$ccid)
{
if ($i!=0) //判断是否为第一次进入循环,如果是则不进行换行操作,否则将进行换行操作!
{ echo "<br>";}
$k=$ccid;
$hh=0;
$strl=0;
$l++; echo "<a href=".$two_url." target=_black><font color=".$two_color.">".$str."</font></a> | "; //显示大类标题
}
$str_len=strlen($str." | ".$row['news_short_title']); //得到长度
if ($str_len>=$lenth) //如果长度等于或等于50,则执行操作后换行。
{
echo "<a href=".$two_url." target=_black><font color=".$two_color.">".$str."</font></a> | <a href=".$read."?news_id=".$row['news_id']."><font color=".$color.">".$row['news_short_title']."</font></a> <br>";$hh=0;$strl=0;$l++;
}else { //如果不是,则计算累加长度,如果大于等于50的时候,将回车换行。
$hh+=strlen($row['news_short_title']);
$strl=strlen($str." | ");
if ($hh+$strl>=$lenth)
{
echo "<br>";
echo "<a href=".$two_url." target=_black><font color=".$two_color.">".$str."</font></a> | ";
$hh=strlen($row['news_short_title']);
//$strl=0;
$l++;
}
echo "<a href=".$read."?news_id=".$row['news_id']."><font color=".$color.">".$row['news_short_title']."</font></a> ";
}
if ($l>=$lenth_height) {break;}
}
}
}
//*********************************************************************
// 测试阶段模块 over
//*********************************************************************
//*********************************************************************
// 测试阶段模块 首页广告
//*********************************************************************function av()
{
$one="select * from av_where";
$query=mysql_query($one);
$num=mysql_num_rows($query);
echo "<a href=av.php?avt=0 target=main> 不作处理 <br>";
if ($num>0) {
while ($result=mysql_fetch_array($query))
{
echo " <a href=av.php?avt=".$result['av_where_id']." target=main>".$result['av_where_name']."<br>";
}
}
}//*********************************************************************
// 测试阶段模块 首页广告 over
//*********************************************************************