• 相关文章调用,如果文章没有图片,随机调用预先上传图片

    <ul class="related"><span><h1>相关文章</h1></span>
                          {php}
                            $related = $zbp->GetArticleList('*', array(array('=', 'log_Type', 0), array('=', 'log_Status', 0)), array('log_PostTime' => 'DESC'), 5, null,false);
                           {/php} {foreach GetList(5,$article.Category.ID) as $related}
                         
                        <li  style="float:left; width: 15%; height: 200px;padding: 12px; ">
                          
                                <img src="
                          {php}
                   $randimg=rand(1,4);
                  $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
                  $content = $related->Content;
                              preg_match_all($pattern,$content,$matchContent);
                                  if(isset($matchContent[1][0]))
                                 $randimg=$matchContent[1][0];
                                 else
                                 $randimg="$host/zb_users/theme/default/style/default/$randimg.jpg";
                                  {/php}
                                {$randimg}"
                                class="pic" width="100%" title="{$related.Url}" height="50%" alt="{$related.Url}"
                                pagespeed_url_hash="3167944164">
                            </a>
                            <a href="{$related.Url}" title="{$related.Title}">
    
              {$related.Title}	</a>
                           
                        </li>
                     {/foreach}
                    </ul>
  • 网站分类
    搜索
    最新留言
      文章归档