PHP建站技术分享-从入门到精通PHP建站技术分享-从入门到精通PHP建站技术分享-从入门到精通

QQ:420220301 微信/手机:150-3210-7690
当前位置:首页 > CMS教程 > WellCMS

Wellcms,搜索功能

管理员 2024-12-15
WellCMS
139

wellcms 2.0 页头导航加搜索框


<div class="form-group px-2 mb-0 mt-2">
    <form action="<?php echo url('operate-search'); ?>" id="form-search">
        <div class="input-group input-group-sm mb-0">
            <input type="text" class="form-control" placeholder="<?php echo lang('keyword'); ?>" name="keyword" value="">
            <input type="hidden" name="range" value="1">
            <div class="input-group-append">
                <button class="btn btn-secondary btn-search-sm" type="submit" id="submit">
                    <i class="icon-search"></i>
                </button>
            </div>
        </div>
    </form>
</div>


搜索结果页模板,对应的文件 view/htm/search.htm

<div class="row">
   <div class="col-lg-10 mx-auto">
      <div class="card">
         <div class="card-body">
            <!-- 搜索表单 / start -->
            <form action="<?php echo url('operate-search');?>" id="form-search">
               <div class="input-group mb-3">
                  <input type="text" class="form-control" placeholder="<?php echo lang('keyword');?>" name="keyword" value="<?php echo $keyword_decode;?>">
                  <div class="input-group-append">
                     <button class="btn btn-primary" type="submit" id="submit">
                        <?php echo lang('search');?>
                     </button>
                  </div>
               </div>
            
               <?php if($search_type == 'like') { ?>
               <div class="form-group">
                  <label class="form-check-inline">
                     <input class="form-check-input" type="radio" name="range" value="1" <?php echo $range == '1' ? 'checked' : '';?>>
                     <?php echo lang('thread');?>
                     </label>
               </div>
               <?php } ?>
            </form>
            <!-- 搜索表单 / end -->
         </div>
      </div>

      <!-- 搜索结果 / start -->
      <?php if($keyword) { ?>
      <?php if($range == 1) { ?>
      <?php if(!empty($threadlist)) { ?>
      
      <div class="card">
         <div class="card-header">
            <ul class="nav nav-tabs card-header-tabs">
               <li class="nav-item">
                  <a class="nav-link <?php echo $active == 'default' ? 'active' : '';?>" href="<?php echo $conf['path'];?>">
                     <?php echo lang('thread_list');?>
                  </a>
               </li>
            </ul>
         </div>
         <div class="card-body">
            <!--
            此处为 加载了公用列表文件
            注意 ul 中class="threadlist" 管理时使用,前台不需要管理可删除
            -->
            <ul class="list-unstyled threadlist mb-0">
            <?php include _include(APP_PATH.'view/htm/thread_list.inc.htm');?>
            </ul>
         </div>
      </div>
      
      <?php }} else { ?>
      
      <div class="card">
         <div class="card-body">
            <?php echo lang('none');?>
         </div>
      </div>
      
      <?php } ?>
      
      <!--
       管理模块,不需要可删除
      -->
      <?php include _include(APP_PATH.'view/htm/thread_list_mod.inc.htm');?>
      
      <!-- 搜索内容分页 / start -->
      <?php if($pagination) { ?>
      <nav>
            <ul class="pagination justify-content-center">
                <?php echo $pagination; ?>
            </ul>
        </nav>
      <?php } ?>
      <!-- 搜索内容分页 / end -->
      
      <?php } ?>
      <!-- 搜索结果 / end -->
   </div>
   
   <!-- 右侧暂时无用
   <div class="col-lg-3 hidden-sm hidden-md">
      <div class="card card-body">
         <h4 class="card-title">筛选条件</h4>
      </div
    </div>
    -->
</div>



希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。

相关推荐

扫码关注

qrcode

QQ交谈

回顶部