Skip to content

Instantly share code, notes, and snippets.

@silentworks
Created January 23, 2013 10:23
Show Gist options
  • Save silentworks/4604099 to your computer and use it in GitHub Desktop.
Save silentworks/4604099 to your computer and use it in GitHub Desktop.
Resource already exist
function aliasExists($pageId, $parent = null){
$modx = modX::getInstance();
$c = $modx->newQuery('modResource');
$c->where(array('alias' => $pageId));
if ($parent) {
$c->andCondition(array('parent' => $parent));
}
$count = $modx->getCount('modResource', $c);
if ($count){
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment