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


PHP search::save方法代码示例

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


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

示例1: addContentToSearch

 /**
  * add all module items to search index
  * @return int
  */
 function addContentToSearch()
 {
     global $db, $router;
     $count = 0;
     $model = new $this->basemodel_name(null, false, false);
     $content = $db->selectArrays($model->tablename);
     foreach ($content as $cnt) {
         $origid = $cnt['id'];
         unset($cnt['id']);
         // get the location data for this content
         if (isset($cnt['location_data'])) {
             $loc = expUnserialize($cnt['location_data']);
         }
         $src = isset($loc->src) ? $loc->src : null;
         //build the search record and save it.
         $search_record = new search($cnt, false, false);
         $search_record->original_id = $origid;
         $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];
         $link = str_replace(URL_FULL, '', makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'id' => $origid, 'src' => $src)));
         //	        if (empty($search_record->title)) $search_record->title = 'Untitled';
         $search_record->view_link = $link;
         $search_record->ref_module = $this->classname;
         $search_record->category = $this->searchName();
         $search_record->ref_type = $this->searchCategory();
         $search_record->save();
         $count += 1;
     }
     return $count;
 }
开发者ID:notzen,项目名称:exponent-cms,代码行数:33,代码来源:expController.php

示例2: addContentToSearch

 function addContentToSearch()
 {
     global $db, $router;
     $model = new $this->basemodel_name();
     $total = $db->countObjects($model->table);
     $count = 1;
     for ($i = 0; $i < $total; $i += 100) {
         $orderby = 'id LIMIT ' . ($i + 1) . ', 100';
         $content = $db->selectArrays($model->table, 'parent_id=0', $orderby);
         foreach ($content as $cnt) {
             $origid = $cnt['id'];
             $prod = new product($cnt['id']);
             unset($cnt['id']);
             //$cnt['title'] = $cnt['title'].' - SKU# '.$cnt['model'];
             $cnt['title'] = (isset($prod->expFile['mainimage'][0]) ? '<img src="' . URL_FULL . 'thumb.php?id=' . $prod->expFile['mainimage'][0]->id . '&w=40&h=40&zc=1" style="float:left;margin-right:5px;" />' : '') . $cnt['title'] . (!empty($cnt['model']) ? ' - SKU#: ' . $cnt['model'] : '');
             $search_record = new search($cnt, false, false);
             $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];
             $search_record->view_link = $router->makeLink(array('controller' => $this->baseclassname, 'action' => 'showByTitle', 'title' => $cnt['sef_url']));
             $search_record->ref_type = $this->basemodel_name;
             $search_record->ref_module = 'store';
             $search_record->category = 'Products';
             $search_record->original_id = $origid;
             //$search_record->location_data = serialize($this->loc);
             $search_record->save();
             $count += 1;
         }
     }
     return $count;
 }
开发者ID:notzen,项目名称:exponent-cms,代码行数:29,代码来源:storeController.php


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