Check if Resource type is Static Resource or Document Resource
-
14-07-2021 - |
سؤال
I wanted to know what is the right syntax on a conditional statement way to check if a Resource used is static or Document? I have a single template that can be used with 2 different types of resource.
So the conditional statement might be like this:
[[+template:is=
static
:then=This is static resource
:else=This is document resource
]]
Anyone knows how to do it in MODx? I'm using MODx revolution latest version.
Thanks :)
المحلول
you want to check the [[*class_key]] variable of the resource in question.
[[+class_key:is='modDocument':then='This is document resource']]
you also have modWebLink & modSymLink, I don't know what the static resource is ~ at a guess modStatic?
نصائح أخرى
this is coming a lot later but just for the benefit of those that may come along later, the key for static resource is modStaticResource.