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


PHP modX::getValue方法代碼示例

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


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

示例1: isDuplicateAlias

 /**
  * Tests to see if an alias is a duplicate.
  *
  * @param string $aliasPath The current full alias path. If none is passed,
  * will build it from the Resource's currently set alias.
  * @param string $contextKey The context to search for a duplicate alias in.
  * @return mixed The ID of the Resource using the alias, if a duplicate, otherwise false.
  */
 public function isDuplicateAlias($aliasPath = '', $contextKey = '')
 {
     if (empty($aliasPath)) {
         $aliasPath = $this->getAliasPath($this->get('alias'));
     }
     $criteria = $this->xpdo->newQuery('modResource');
     $where = array('id:!=' => $this->get('id'), 'uri' => $aliasPath, 'deleted' => false, 'published' => true);
     if (!empty($contextKey)) {
         $where['context_key'] = $contextKey;
     }
     $criteria->select('id');
     $criteria->where($where);
     $criteria->prepare();
     $duplicate = $this->xpdo->getValue($criteria->stmt);
     return $duplicate > 0 ? (int) $duplicate : false;
 }
開發者ID:DeFi-ManriquezLuis,項目名稱:MTLTransfer,代碼行數:24,代碼來源:modresource.class.php

示例2: define

}
if (!defined('MODX_API_MODE')) {
    define('MODX_API_MODE', true);
}
$resource_id = !empty($_GET['page_id']) && is_numeric($_GET['page_id']) ? $_GET['page_id'] : 1;
$output = array('prod_list' => '', 'pages' => '', 'total' => 0, 'pageCount' => 1, 'onPageLimit' => 1);
require_once '../../../config.core.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
//get resourse context_key
$context_key = 'web';
$query = $modx->newQuery('modResource', array('id' => $resource_id, 'published' => true, 'deleted' => false));
$query->select($modx->getSelectColumns('modResource', '', '', array('context_key')));
$stmt = $query->prepare();
if ($stmt) {
    if ($value = $modx->getValue($stmt)) {
        $context_key = $value;
    }
}
$modx->initialize($context_key);
//get resource
$criteria = $modx->newQuery('modResource');
$criteria->select(array($modx->escape('modResource') . '.*'));
$criteria->where(array('id' => $resource_id, 'deleted' => false, 'published' => true));
$modx->resource = $modx->getObject('modResource', $criteria);
if (!is_object($modx->resource) || !$modx->resource->checkPolicy('view')) {
    echo json_encode($output);
    exit;
}
$modx->resourceIdentifier = $modx->resource->get('id');
$modx->getService('error', 'error.modError');
開發者ID:MobiTeam,項目名稱:mirfoto,代碼行數:31,代碼來源:ajax_resources.php


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