Created
October 29, 2011 03:34
-
-
Save oksushi/1324041 to your computer and use it in GitHub Desktop.
If you forget to set the alias with bulk-created resources in MODX, this will help you adjust them
This file contains 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
<?php | |
// | |
// Create Alias | |
// Receives a template and a new alias and will adjust the alias of each of those docs | |
$template = $modx->getOption('template',$scriptProperties,'1'); | |
$newAlias = $modx->getOption('alias',$scriptProperties,'1'); | |
$changeddocs = $modx->getCollection('modResource',array( | |
'template' => $template | |
)); | |
foreach($changeddocs as $thisdoc){ | |
$thisdoc->set('alias',$newAlias); | |
$thisdoc->save(); | |
} | |
//profit! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment