zblog php 随机文章代码如下:带缩略图

<li class="widget widget_random_posts">     ...

<li class="widget widget_random_posts">
                                <header>
                                    <h3>
                                        <i class="fa fa-certificate">
                                        </i>
                                        随机文章
                                    </h3>
                                </header>
                                <div class="main">
                                    <ul class="thumb">
                                        {php}
                                            $articles=$zbp->GetArticleList(
                                            array('*'),
                                            array(array('=','log_Type',0),
                                            array('=','log_Status',0)),
                                            array('rand()'=>' '),
                                            array(5),
                                            null
                                            );
                                        {/php}
                                         {foreach $articles as $article}
                                        <li>

                                            <a href="{$article.Url}" class="picbox"
                                            rel="bookmark" title="{$article.Title}">
                                                <img src="{php}$clsjtp=rand(1,4);$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";$content = $article->Content;
                                                  preg_match_all($pattern,$content,$matchContent);
                                                  if(isset($matchContent[1][0]))
                                                  $clsjtp=$matchContent[1][0];
                                                  else
                                                  $clsjtp="$host/zb_users/theme/$theme/style/img/suiji/$clsjtp.jpg";{/php}{$clsjtp}"class="thumb" width="60" height="60" title="{$article.Title}"
                                                alt="{$article.Title}" />
                                            </a>
                                            <h4 class="title">
                                                <a href="{$article.Url}" title="{$article.Title}">
                                                    {$article.Title}
                                                </a>
                                            </h4>
                                            <p class="postmeta">
                                                <span class="time">
                                                    {$article.Time('Y-m-d')}
                                                </span>
                                                <span class="eye">阅读({$article.ViewNums})</span>
                                            </p>
                                        </li>
                                          {/foreach}
                                    </ul>
                                </div>
                            </li>


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请通知我们,一经查实,本站将立刻删除。


客服