-
- 15 Posts
Not sure if this is the correct thread for my question. But here goes:
I've installed SwitchTemplate. I need to be able to switch the default template for a group of images to another template if there is only one image in the group.
Is there a way to add SwitchTemplate in a snippet? I have
$count = count($modx->getChildIds($parentTvValue,1));
if ($count == 1) { Code to switch template }
what code do I need to use?
-
- 5 Posts
Maybe it would be a good idea not to switch template for pages that have blank template?
Something like (line 134)
// stop, if resource id is not in include list or in exclude list
if ((count($include) && (!in_array($resourceId, $include))) ||
(count($exclude) && (in_array($resourceId, $exclude))) ||
!($this->modx->resource->get('template')>0) // added!
) {
return null;
}
in core/components/switchtemplate/model/switchtemplate/switchtemplate.class.php