聽風資源網 - 線報,軟件,教程分享-聽風教程網 - 專注網絡分享
?

emlog文章調用列表+今日更新紅色標題+置頂單獨代碼

發布:聽風資源網2018-9-16 10:20分類: 模板插件 關鍵詞: 字數:2407

傲游截圖20180916102040.png

將一下函數代碼放在模板的module.PHP里

<?php //自己寫的最新文章調用函數
date_default_timezone_set('Asia/Shanghai');
function aizhanyunblog_new($num){
	$db=mysql::getInstance();
    $n = $db->query("SELECT gid ,title FROM " . DB_PREFIX . "blog WHERE hide='n' and type='blog' and top='y' ORDER BY date DESC");
	$nums = $db->num_rows($n);
	while ($rows = $db->fetch_array($n)){
        $rows['title'] = htmlspecialchars($rows['title']);
     ?>
    <li><img src="http://f162.cn.cn/zb_users/theme/aizhanyunblog/style/img/740.gif" alt="會飛對魚" class="themeauthor" style="opacity: 1;">&nbsp;<em style="color:#1B00FF;font-style:normal !important;"><b>[置頂]</b></em>
      <a href="<?php echo url::log($rows['gid']); ?>" title="<?php echo $rows['title']; ?>" ><b><?php echo $rows['title']; ?></b></a></li>
	<?php }
	$log_range = '';
	if($nums > 0){
		$n2 = $db->query("SELECT gid FROM " . DB_PREFIX . "blog WHERE hide='n' and type='blog' and top='y' ORDER BY date DESC");
		while ($rows2 = $db->fetch_array($n2)){
		$log_range.= ' gid != '.$rows2['gid'].' and ';
		}
	}
	$log_num = $num - $nums;
	$logs = $db->query("SELECT gid ,title ,date FROM " . DB_PREFIX . "blog WHERE hide='n' and type='blog' and $log_range gid != 0 ORDER BY date DESC LIMIT 0, $log_num");
    while ($row = $db->fetch_array($logs)){
        $row['title'] = htmlspecialchars($row['title']);
     ?>
    <li><img src="http://f162.cn/zb_users/theme/aizhanyunblog/style/img/740.gif" alt="hony" class="themeauthor" style="opacity: 1;">&nbsp;<a href="<?php echo Url::log($row['gid']); ?>" title="<?php echo $row['title']; ?>" ><b style="display:inline-block;line-height:16px;<?php echo gmdate('m-d', $row['date'])==date('m-d')?'color:red':null ?>"><?php echo mb_substr($row['title'],0,18,'utf-8');?></b></a><span style="float:right;<?php echo gmdate('m-d', $row['date'])==date('m-d')?'color:red':null ?>"><?php echo gmdate('m-d',$row['date']);?></span>
	</li>
	<?php }
}
?>


前臺調用php

<div class="CMSlist cmslist2">
<?php aizhanyunblog_new(20);?>
</div>

css代碼

//這里是css浮動代碼,需要自行防御css文件里即可
.cmslist ul{padding: 3.5px 0;}
.cmslist li{height:28px;line-height:28px;font-size:14px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}
.cmslist li time{margin-left:5px;}
.cmslist2{float:none;width:100%;min-height:240px;}
.cmslist2 ul{overflow:hidden;}
.cmslist2 li{float:left;width:310px;margin:0 30px 0 0;}





正文到此結束
 

發表評論

電子郵件地址不會被公開。 必填項已用*標注

此處粘貼暢言代碼,自適應最好。。
?
sitemap 最近排列五500期走势图