I have a widget in sidebar that I want to show on all pages except the children of a container with id, for example, 418 (at the same time the widget should be visible for 418).
Didn't find anything similar in IF
package.
First and somewhat primitive solution could be just creating a new template by slightly modifying the current one (removing the widget) and then setting the newly created template for the pages where the widget shouldn't be shown.
The second approach I thought about is to get somehow a resource's parent id and then use it in a "proxy" chunk (instead of calling the widget's chunk directly) inside your current template like this:
[[!If?
&subject=`[[!getParentId]]`
&operator=`EQ`
&operand=`418`
&then=``
&else=`[[$yourWidget]]`
]]
There should be some extras with needed functionality to get parent's id or you can always write your own small "getParentId" snippet based on this:
return $modx->getParentIds( $modx->resource->id );