1949啦网--小小 痛苦,是因为能力和欲望不匹配造成的

zblog侧栏最新发布文章(带缩略图)的方法

我发本站侧栏最新发布文章(带缩略图)的方法发下。

1.实际上也很简单,我的这个代码是根据官方给的c_system_event.php里的最新文章模板改写的,现在发下,希望对你有用,同时对大家有帮助。

2.我的网站侧栏并没有采用官网给的侧栏功能,只是自定义了侧栏模块,

3.侧栏最新发布文章代码如下:

<article class="widget widget_postlist">              <header>                  <h3>                      <i class="icon-list">                      </i>                        最新发布                  </h3>              </header>              <div class="main">                 <ul class="postlist_pictxt">                        {php}                          $articles = $zbp->GetArticleList('*', array(array('=', 'log_Type', 0), array('=', 'log_Status', 0)), array('log_PostTime' => 'DESC'), 5, null,false);                         {/php}                          {foreach $articles as $article}                      <li>                          <a href="{$article.Url}" class="pic-a" rel="bookmark"                          title="{$article.Title}">                              <i class="icon-arrow-right">                              </i>                              <img src="                        {php}                 $zuixinf=rand(1,4);                $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";                $content = $article->Content;                            preg_match_all($pattern,$content,$matchContent);                                if(isset($matchContent[1][0]))                               $zuixinf=$matchContent[1][0];                               else                               $zuixinf="$host/zb_users/theme/$theme/style/img/suiji/$zuixinf.jpg";                                {/php}                              {$zuixinf}"                              class="pic" width="60" title="{$article.Title}" height="60" alt="{$article.Title}"                              pagespeed_url_hash="3167944164">                          </a>                          <a href="{$article.Url}" class="title" title="{$article.Title}">                              <i class="icon-arrow-right">                              </i>                              {$article.Title}                          </a>                          <span class="time">                              {$article.Time('Y-m-d')}                          </span>                          <span class="eye">                              浏览{$article.ViewNums}次                          </span>                      </li>                   {/foreach}                  </ul>                  <div class="clear">                  </div>              </div>  </article>

效果如图:

原文链接:https://www.qiquanji.com/post/7135.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注

更新实时通知

作者:xialibing 分类:网页教程 浏览: