Created
January 23, 2013 10:23
-
-
Save silentworks/4604099 to your computer and use it in GitHub Desktop.
Resource already exist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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