当前位置: 首页>>代码示例>>PHP>>正文


PHP PbModel::setCondition方法代码示例

本文整理汇总了PHP中PbModel::setCondition方法的典型用法代码示例。如果您正苦于以下问题:PHP PbModel::setCondition方法的具体用法?PHP PbModel::setCondition怎么用?PHP PbModel::setCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PbModel的用法示例。


在下文中一共展示了PbModel::setCondition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_block_getdata


//.........这里部分代码省略.........
    }
    if (isset($params['include'])) {
        $conditions[] = $M->getIncludeIds($params['include']);
    }
    if (isset($params['orderby'])) {
        $orderbys[] = trim($params['orderby']);
    }
    if (!empty($row) && $row != 'all' && $row != -1) {
        $M->setLimitOffset($offset, $limit);
        $mysql_limit = $M->getLimitOffset();
    }
    if (!empty($params['limit'])) {
        $mysql_limit = " " . trim($params['limit']);
    }
    if (!empty($_GET['producttypeid'])) {
        $conditions[] = "type_id=" . intval($_GET['producttypeid']);
    }
    if (!empty($params['companyid'])) {
        $conditions[] = "company_id=" . intval($params['companyid']);
    }
    if (!empty($params['industryid'])) {
        $conditions[] = "industry_id=" . intval($params['industryid']);
    }
    if (!empty($params['typeid'])) {
        if ($_table == 'adses') {
            $conditions[] = "adzone_id=" . intval($params['typeid']);
        } else {
            $conditions[] = "type_id=" . intval($params['typeid']);
        }
    }
    if (empty($sTemplate->block_data[$iTags])) {
        # ************************************************************************
        # Main content
        $M->setCondition($conditions);
        $M->setOrderby($orderbys);
        $sql = sprintf("SELECT * FROM %s%s %s %s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition(), $M->getOrderby(), $mysql_limit);
        $sTemplate->block_data[$iTags] = $M->GetArray($sql);
        //如果没有数据,那就不用再执行了(repeat)
        if (!$sTemplate->block_data[$iTags]) {
            return $repeat = false;
        }
        if (isset($stat)) {
            $_total_count = $M->dbstuff->GetOne(sprintf("SELECT count(*) FROM %s%s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition()));
            $sTemplate->assign('total_count', $_total_count);
            $sTemplate->assign("paging", array('total' => $_total_count));
        }
        # End main content
        # ************************************************************************
    }
    if (!$sTemplate->block_data[$iTags]) {
        $repeat = false;
        return '';
    }
    if (!function_exists("smarty_function_the_url")) {
        require "function.the_url.php";
    }
    $counts = count($sTemplate->block_data[$iTags]);
    if (list($key, $item) = each($sTemplate->block_data[$iTags])) {
        $_title = $_title_full = $_content = $_content_full = '';
        $item['rownum'] = $key;
        $item['iteration'] = ++$key;
        if (!empty($item['url'])) {
            $url = $item['url'];
        } else {
            $url = smarty_function_the_url(array("do" => $module, "id" => $item['id'], "action" => 'detail'));
        }
开发者ID:haojielyb,项目名称:phpb2b,代码行数:67,代码来源:block.getdata.php

示例2: PbController

         if (!empty($search_word)) {
             $condition[] = "title LIKE '%{$search_word}%'";
         }
         break;
 }
 $search_controller = new PbController();
 $model_name = htmlspecialchars($do, ENT_QUOTES);
 $model_name = strtolower($search_controller->pluralize(ucwords($model_name)));
 if (!empty($_GET['id'])) {
     $id = intval($_GET['id']);
     $result = $pdb->GetRow("SELECT *" . $extra . " FROM " . $tb_prefix . $model_name . " WHERE id=" . $id);
     setvar("item", $result);
     $tpl_file = "wap/detail";
 } else {
     $model_common = new PbModel();
     $model_common->setCondition($condition);
     //pager
     $pagesize = 10;
     $page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
     $total = $pdb->GetOne("SELECT count(id) FROM " . $tb_prefix . $model_name . $model_common->getCondition());
     $pagecount = ceil($total / $pagesize);
     if ($page > $pagecount) {
         $page = $pagecount;
     }
     if ($page <= 0) {
         $page = 1;
     }
     $offset = ($page - 1) * $pagesize;
     $pre = $page - 1;
     $next = $page + 1;
     $first = 1;
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:index.php


注:本文中的PbModel::setCondition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。