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

时间:6年前   阅读:4991

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

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,我们将及时处理。

微信扫码关注

更新实时通知

上一篇:JS原生拖放功能的实现模拟拖拽效果

下一篇:Bootstrap分裂式按钮下拉菜

网友评论

请先 登录 再评论,若不是会员请先 注册