當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cabinet::read方法代碼示例

本文整理匯總了PHP中Cabinet::read方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cabinet::read方法的具體用法?PHP Cabinet::read怎麽用?PHP Cabinet::read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cabinet的用法示例。


在下文中一共展示了Cabinet::read方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Cabinet

 function insert_cabinet_to_drupal($cabinet_id)
 {
     // set HTTP_HOST or drupal will refuse to bootstrap
     $_SERVER['HTTP_HOST'] = 'zl-apps';
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
     $cabinet = new Cabinet();
     $cabinet_detail = $cabinet->read(null, $cabinet_id);
     $cabinet_nid = null;
     $query = new EntityFieldQuery();
     $entities = $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'cabinet')->propertyCondition('status', 1)->fieldCondition('field_cabinet_id', 'value', $cabinet_detail['Cabinet']['id'], '=')->execute();
     if (!empty($entities)) {
         foreach ($entities['node'] as $nid => $value) {
             $cabinet_nid = $nid;
             break;
             // no need to loop more even if there is multiple (it is supposed to be unique
         }
     }
     $node = null;
     if (is_null($cabinet_nid)) {
         $node = new stdClass();
         $node->language = LANGUAGE_NONE;
     } else {
         $node = node_load($cabinet_nid);
     }
     $node->type = 'cabinet';
     node_object_prepare($node);
     $node->title = $cabinet_detail['Cabinet']['name'];
     $node->field_cabinet_id[$node->language][0]['value'] = $cabinet_detail['Cabinet']['id'];
     $node->field_product_type_id[$node->language][0]['value'] = $cabinet_detail['Cabinet']['product_type'];
     $node->sell_price = 0;
     $node->model = $cabinet_detail['Cabinet']['name'];
     $node->shippable = 1;
     $path = 'cabinet/' . $node->title;
     $node->path = array('alias' => $path);
     node_save($node);
 }
開發者ID:khaled-saiful-islam,項目名稱:zen_v1.0,代碼行數:38,代碼來源:Cabinet.php


注:本文中的Cabinet::read方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。