求助!!!列表页不能正常调用图片

发布时间:2019-10-12

仿站网>问答 > 求助!!!列表页不能正常调用图片
各位老师好!

      我网站 首页、列表页的标题图片 是自动调用内容页里的图片的,如果内容里有一张图片,列表页就会调用一张,如果内容页里有三张或者三张以上图片,就会自动调用前三张图片。(网站首页,频道列表页类似于今日头条那种模式)

      【现在面临的问题】:我网站发新闻,采集新闻,内容页里的图片很多都没有本地化。这就造成列表页的标题图片显示为: X图(就是图片打不开的那种样子,很难看),图片本地化的内容页不存在这个问题。

      
      请教:列表页标题小图 如何自动调用内容页里没有本地化的图片。以下为列表页的代码:


<?php
$ye=strFilter($_GET['next']);
function strFilter($str){
    $str = str_replace('`', '', $str);
    $str = str_replace('·', '', $str);
    $str = str_replace('~', '', $str);
    $str = str_replace('!', '', $str);
    $str = str_replace('!', '', $str);
    $str = str_replace('@', '', $str);
    $str = str_replace('#', '', $str);
    $str = str_replace('$', '', $str);
    $str = str_replace('¥', '', $str);
    $str = str_replace('%', '', $str);
    $str = str_replace('^', '', $str);
    $str = str_replace('……', '', $str);
    $str = str_replace('&', '', $str);
    $str = str_replace('*', '', $str);
    $str = str_replace('(', '', $str);
    $str = str_replace(')', '', $str);
    $str = str_replace('(', '', $str);
    $str = str_replace(')', '', $str);
    $str = str_replace('-', '', $str);
    $str = str_replace('_', '', $str);
    $str = str_replace('——', '', $str);
    $str = str_replace('+', '', $str);
    $str = str_replace('=', '', $str);
    $str = str_replace('|', '', $str);
    $str = str_replace('', '', $str);
    $str = str_replace('[', '', $str);
    $str = str_replace(']', '', $str);
    $str = str_replace('【', '', $str);
    $str = str_replace('】', '', $str);
    $str = str_replace('{', '', $str);
    $str = str_replace('}', '', $str);
    $str = str_replace(';', '', $str);
    $str = str_replace(';', '', $str);
    $str = str_replace(':', '', $str);
    $str = str_replace(':', '', $str);
    $str = str_replace(''', '', $str);
    $str = str_replace('"', '', $str);
    $str = str_replace('“', '', $str);
    $str = str_replace('”', '', $str);
    $str = str_replace(',', '', $str);
    $str = str_replace(',', '', $str);
    $str = str_replace('<', '', $str);
    $str = str_replace('>', '', $str);
    $str = str_replace('《', '', $str);
    $str = str_replace('》', '', $str);
    $str = str_replace('.', '', $str);
    $str = str_replace('。', '', $str);
    $str = str_replace('/', '', $str);
    $str = str_replace('、', '', $str);
    $str = str_replace('?', '', $str);
    $str = str_replace('?', '', $str);
    return trim($str);
}
require('../e/class/connect.php');
if (!defined('InEmpireCMS'))
{
        exit(0);
}
require('../e/class/db_sql.php');
require('../e/class/q_functions.php');
$link=db_connect();
$empire=new mysqlquery();
$yema=$ye*35;
$query = ("select * from www_zxwetb_abjk_ecms_news order by newstime desc limit $yema,35") or die("SQL语句执行失败2");
$query=$empire->query($query);
while ($rs=mysql_fetch_assoc($query))
{
        $src=$rs[id];
        $xwtitle=$rs['title'];
        $xwtitleurl=$rs['titleurl'];
        $xwtitlepic=$rs['titlepic'];
        $newstime=date('Y-m-d',$rs['newstime']);
        $onclick=$rs['onclick'];
        if ($rs['writer']=='')
        {
                $writer='匿名';
        }
        else
        {
                $writer=$rs[writer];
        }
        $tsqlqq=$empire->query('select * from www_zxwetb_abjk_ecms_news_data_1 where id='.$rs[id]);
        while ($trssss=$empire->fetch($tsqlqq))
        {
                $neirong=$trssss['newstext'];
        }
        $imgnum=substr_count($neirong,'<img');
        $pattern='/<img.*?"([^"]*(jpg|bmp|jpeg|png|gif)).*?>/';
        preg_match_all($pattern,$neirong,$match);
        if ($imgnum==3 || $imgnum>3)
        {
                $tu1=str_replace(''','',str_replace('"','',$match[1][0]));
                $tu2=str_replace(''','',str_replace('"','',$match[1][1]));
                $tu3=str_replace(''','',str_replace('"','',$match[1][2]));
                echo '
<section class="news-item news-item-s2"><a data-accurateurl="" data-type="keji" data-subtype="" href="'.$xwtitleurl.'">
                          <div class="news-wrap">
                                <h3>'.$xwtitle.'</h3>
                                <div class="img-wrap clearfix">
                                  <div class="img fl"><img class="lazy" src="'.$tu1.'"></div>
                                  <div class="img fl"><img class="lazy" src="'.$tu2.'"></div>
                                  <div class="img fl"><img class="lazy" src="'.$tu3.'"></div>
                                </div>
                                <p class="tags clearfix"><em class="tag tag-time">'.$newstime.'</em><em class="tag tag-src">头条资讯</em><em class="tag tag-view">'.$onclick.'阅读</em></p>
                          </div>
                          </a></section>
';
        }
        else
        {
                if ($xwtitlepic=='')
                {
                        echo '';
                }
                else
                {
                        echo '
                        <section class="news-item news-item-s1"><a data-type="qiche" data-subtype="" href="'.$xwtitleurl.'">
                          <div class="news-wrap clearfix">
                                <div class="txt-wrap fl">
                                  <h3>'.$xwtitle.'</h3>
                                  <p class="tags clearfix"><em class="tag tag-time">'.$newstime.'</em><em class="tag tag-src">头条资讯</em><em class="tag tag-view">'.$onclick.'阅读</em></p>
                                </div>
                                <div class="img-wrap fr"><img data-lbimg="'.$xwtitlepic.'" class="lazy" src="'.$xwtitlepic.'"></div>
                          </div>
                          </a></section>
';
                }
        }
}
?>



     如何修改上面的代码,让内容页已经本地化的图片,还有未本地化的图片,在列表页都能显示,本人菜鸟一个,麻烦、辛苦老师帮忙修改上面的代码,并在帖子里贴出来。万分感谢!
回复列表
1.
我也不会,请问你的是怎么弄的加载更多的,我的成功?能给个教程吗?谢谢
2.
你QQ多少
相关问题
仿站网专注于帝国CMS仿站及二次开发、模板定制等各种有关帝国CMS程序疑难杂症!
  • 首页
  • 客服
  • 头部