jquery php 百度搜索,jquery实现搜索功能

function _search(){

var val = $(".banner-search__search").val();

if(!val){

layer.msg('不能为空');

return false;

}

location.href='/index.php?s=mall&c=search&m=show&keywords='+val;

}

if (!defined('BASEPATH')) exit('No direct script access allowed');

/**

* Dayrui Website Management System

*

* @sinceversion 2.0.0

* @authorDayrui

* @license http://www.dayrui.com/license

* @copyright Copyright (c) 2011 - 9999, Dayrui.Com, Inc.

* @filesourcesvn://www.dayrui.net/v2/news/controllers/search.php

*/

class Search extends M_Controller {

/**

* 构造函数

*/

public function __construct() {

parent::__construct();

}

/**

* 搜索

*/

public function index() {

parent::_search();

}

public function show() {

//获取搜索关键词

$keywords = $this->input->get('keywords');

//根据搜索关键词,获取城市/学校的所有childids

$linkage_id = $this->db->like('name', $keywords)->get('mt_linkage_data_3')->result_array();

$linkage_childids=$linkage_id[0]["childids"];

//如果搜索到结果

if(!empty($linkage_childids)){

$this->template->assign(array(

'linkage_childids' => $linkage_childids

));

$this->template->display('search.html');

//如果没有搜索到结果

}else{

$this->template->display('gather_info.html');

}

}

}

{list action=module module=mall IN_quyu=$linkage_childids }

%7Bdr_thumb(%24t.thumb)%7D
{$t.title}{dr_cat_value($t.catid,'name')}

{$t.shi}室

距离学校少于1 mile

{$t.wei}个卫生间

{if in_array("23",$t.fangwusheshi)} 提供免费Wifi上网服务 {else if in_array("24",$t.fangwusheshi)} 提供付费Wifi上网服务 {else} 不提供wifi上网服务 {/if}

最低

{php $price = array();}

{php $group = $t.order_specification.option.group0;}

{loop $group $v}

{php $price[] = $t.order_specification.value[$v]['price'];}

{/loop}

${min($price)}起

每周

{/list}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值