看了一下PHOMENEWS标签的函数(如下),可看的不是太懂。我的初步思路是这样的,判断每行的行数能否被2整除,如果能,就让$rowclass=td1, else $rowclass=td2 (td1, td2 是CSS里的两个控制TD颜色的属性,已经在CSS里设置好)。可是我不太清楚下面这个函数哪个variable是控制行数的,看起来$record比较像,但是我又没看出来它是怎么自身增加的。
所以请老大给个指点,哪个变量是控制行数的?还有,如果您知道如何判断这个变量能否被2整除嘛?或者如果您有什么更高效的算法,也请给个建议吧。不好意思,我对PHP不是很懂,处于刚学的阶段。谢谢
function sys_GetClassNews3($classid,$line,$strlen,$showdate=true,$enews=0,$have_class=0,$formatdate='(m-d)') {global $empire; $sql=sys_ReturnBqQuery($classid,$line,$enews,0); $record=0; while($r=$empire->fetch($sql)) { $record=1; $oldtitle=$r[title]; $title=sub($r[title],0,$strlen,false); //标题属性 $title=DoTitleFont($r[titlefont],$r[titlecolor],$title); //显示类别 $myadd=sys_ReturnBqClassname($r,$have_class); //显示时间 if($showdate) { $newstime=format_datetime($r[newstime],$formatdate); $newstime=" ".$newstime; } //标题链接 $titleurl=sys_ReturnBqTitleLink($r); $title=$myadd."<LI><a class=blue_14 href='".$titleurl."' target=_blank title='".$oldtitle."'>".$title."</a></LI>".$newstime; $allnews.="".$title.""; } if($record) { echo"$allnews"; } }
|