亮晶网络

亮晶网络

搜索页面制作说明
2024-12-11

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>