最新公告
  • 欢迎您光临站长源码网,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!立即加入钻石VIP
  • 帝国cms7.5搜索结果列表显示多个表搜索结果实例

    正文概述 管理员   2024-09-02   14

    search.php代码:

    <?php  
    $guanjianci = urldecode($_GET["key"]);  
    $guanjianci = strFilter($guanjianci);  
    
    function strFilter($str) {  
        $str = str_replace(array('/', ' ', '|', '#', '~', '@', '%', '^', '&', '*', '(', ')', '-', '_', ':'), array('', '', '', '', '', '', '', '', '', '', '', '', '', ''), $str); // 添加了缺失的分号  
        return trim($str);  
    }  
    
    if ($guanjianci == '' || $guanjianci == null) {  
        // 可以在这里处理没有搜索关键词的情况  
    } else {  
        require("../e/class/connect.php");  
        if (!defined('InEmpireCMS')) {  
            exit();  
        }  
        require("../e/class/db_sql.php");  
        require("../e/class/q_functions.php");  
        $link = db_connect();  
        $empire = new mysqlquery();  
    ?>  
    <!doctype html>  
    <html>  
    <head>  
        <meta charset="utf-8">  
        <title>站内搜索</title>  
    </head>  
    <body>  
    <div id="main1k">  
    <?php  
        $numnews = $empire->gettotal("SELECT COUNT(*) AS total FROM phome_ecms_news WHERE title LIKE '%$guanjianci%' OR instr('$guanjianci', title) > 0 ORDER BY newstime LIMIT 6");  
        $numgame = $empire->gettotal("SELECT COUNT(*) AS total FROM phome_ecms_app WHERE title LIKE '%$guanjianci%' OR instr('$guanjianci', title) > 0 ORDER BY newstime LIMIT 6");  
        $numguide = $empire->gettotal("SELECT COUNT(*) AS total FROM phome_ecms_sites WHERE title LIKE '%$guanjianci%' OR instr('$guanjianci', title) > 0 ORDER BY newstime LIMIT 6");  
    
        if ($numnews < 1 && $numgame < 1 && $numguide < 1) {  
    ?>  
            <div class="ss_none">  
                <p class="p1">未找到相关搜索结果</p>  
            </div>  
    <?php   
        }  
    
        if ($numgame > 0) {  
    ?>  
            <div class="ss_listbox">  
                <div class="ss_title"><em></em><span>PC软件</span></div>  
                <div class="soft_list">  
    <?php  
            $query = @mysql_query("SELECT * FROM phome_ecms_app WHERE title LIKE '%$guanjianci%' OR instr('$guanjianci', title) > 0 ORDER BY newstime LIMIT 6");  
            while ($rs = mysql_fetch_assoc($query)) {  
                $src = $rs['id'];  
                $pctitle = $rs['title'];  
                $pctitleurl = $rs['titleurl'];  
                $pctitlepic = $rs['titlepic'];  
                $pcsmall = $rs['smalltext'];  
                $pcdaxiao = $rs['daxiao'];  
                $pcnewstime = date('Y-m-d', $rs['newstime']);  
                $pcdengji = $rs['dengji'];  
                $pccr = $empire->fetch1("SELECT bname FROM phome_enewsclass WHERE classid='" . $rs['classid'] . "' LIMIT 1");  
                $pcslei = $pccr['bname'];  
    ?>       
                    <div class="box">  
                        <p class="pic"><a href="<?=$pctitleurl?>" target="_blank"><img src="<?=$pctitlepic?>" alt="<?=$pctitle?>"><span class="cover_74"></span></a></p>  
                        <div class="hd">  
                            <p class="tit"><a href="<?=$pctitleurl?>" target="_blank"><?=str_replace($guanjianci, "<font color='red'>".$guanjianci."</font>", $pctitle)?></a></p>  
                            <p class="xinx"><span>大小:<?=$pcdaxiao?></span> <span>时间:<?=$pcnewstime?></span> <span>类型:<?=$pcslei?></span> <span><em>星级:</em><em class="stars star<?=$pcdengji?>"></em></span></p>  
                            <p class="txt"><?=$pcsmall?></p>  
                            <a class="down" href="<?=$pctitleurl?>" target="_blank">立即下载</a>  
                        </div>  
                    </div>  
    <?php   
            }   
    ?>  
                </div>  
                <div class="more"><a href="/e/search/?searchget=1&tempid=2&tbname=app&keyboard=<?=$guanjianci?>&show=title">更多<span><?=$guanjianci?></span>的结果<em></em></a></div>  
            </div>  
    <?php   
        }  
    
        if ($numnews > 0) {  
    ?>  
            <div class="ss_listbox">  
                <div class="ss_title marb10"><em class="news"></em><span>资讯教程</span></div>  
                <div class="art_listl ss_news">  
    <?php  
            $queryal = @mysql_query("SELECT * FROM phome_ecms_news WHERE title LIKE '%$guanjianci%' OR instr('$guanjianci', title) > 0 ORDER BY newstime LIMIT 6");  
            while ($ral = mysql_fetch_assoc($queryal)) {  
                $src = $ral['id'];  
                $altitle = $ral['title'];  
                $altitleurl = $ral['titleurl'];  
                $altitlepic = $ral['titlepic'];  
                $alsmall = $ral['smalltext'];  
                $alnewstime = date('Y-m-d', $ral['newstime']);  
    ?>       
                    <dl>  
                        <dt><a class="tit" href="<?=$altitleurl?>"><?=str_replace($guanjianci, "<font color='red'>".$guanjianci."</font>", $altitle)?></a></dt>  
                        <dd>  
                            <div class="pic"><a href="<?=$altitleurl?>"><img src="<?=$altitlepic?>" alt="<?=$altitle?>"></a></div>  
                            <div class="info">  
                                <div class="txt"><?=$alsmall?>...</div>  
                                <div class="bottom">  
                                    <p class="time"><?=$alnewstime?></p>  
                                </div>  
                            </div>  
                        </dd>  
                    </dl>  
    <?php   
            }   
    ?>  
                </div>  
                <div class="more" style="padding-top:20px;"><a href="/e/search/?searchget=1&tempid=1&tbname=news&keyboard=<?=$guanjianci?>&show=title">更多<span><?=$guanjianci?></span>的结果<em></em></a></div>  
            </div>  
    <?php   
        }  
    ?>  
    </div>  
    </body>  
    </html>  
    <?php   
    }   
    ?>
    

    HTML代码:

    <form action="/search/search.php" method="get" name="form1" data-node="searchForm" target="_blank" id="form1">
    <span class="icon"></span>
    <input type="text" id="searchfield" class="text" name="key" >
    <button class="button" type="image"></button>
    </form>
    


    站长源码网 » 帝国cms7.5搜索结果列表显示多个表搜索结果实例

    常见问题FAQ

    免费下载或者VIP会员专享资源能否直接商用?
    本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
    提示下载完但解压或打开不了?
    最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用百度网盘软件或迅雷下载。若排除这种情况,可在对应资源底部留言,或 联络我们.。
    找不到素材资源介绍文章里的示例图片?
    对于PPT,KEY,Mockups,APP,网页模版等类型的素材,文章内用于介绍的图片通常并不包含在对应可供下载素材包内。这些相关商业图片需另外购买,且本站不负责(也没有办法)找到出处。 同样地一些字体文件也是这种情况,但部分素材会在素材包内有一份字体下载链接清单。
    模板不会安装或需要功能定制以及二次开发?
    请QQ联系我们

    发表评论

    如需帝国cms功能定制以及二次开发请联系我们

    联系作者

    请选择支付方式

    ×
    支付宝支付
    余额支付
    ×
    微信扫码支付 0 元