Last active
July 7, 2017 09:57
-
-
Save zhabinka/76f77d675e54cc2fe7178546edcf0f22 to your computer and use it in GitHub Desktop.
Массовая смена шаблонов - https://modx.pro/help/12142/#comment-80598
Есть дополнение Batcher для подобных целей.
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
$resources = $modx->getCollection('modResource',array('parent' => 19)); | |
foreach ($resources as $res) { | |
$res->set('template', 3); | |
$res->save(); | |
} |
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 | |
$child = $modx->getChildIds(894, 1, array('context' => 'web')); //894 - id, 1 - вложенность | |
$collection = $modx->getCollection('modResource', array( | |
'id:IN' => $child, | |
//'template' => 8, | |
//'deleted' => false, | |
)); | |
$output = ''; | |
foreach ($collection as $res) { | |
$res->set('template', 28); | |
$res->save(); | |
//$output .= $res->get('id') . ','; | |
} | |
//print $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment