本文整理汇总了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;
}
示例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');