If Defined


If/else tags provide a way of outputting conditional information. The template functionality lets you use an If defined tag and an If Not Defined tag. Within both tags you can insert tags valid for the current context (except global tags which can be used everywhere).

If a template tag has a value or does exist, the values within the If Defined tag will be displayed. Otherwise the value within the If Not defined tag will be displayed. Both tags can be used seperately.


  • Notice that the If tags has to end with an EndIf tag in order to work. 
  • @Else is available from version

Example of usage

The following example illustrates how to use the If tags in a template:

<!--@If Defined(Global:Extranet.UserName)-->
    You are logged in as:<br />


<!--@If Not Defined(Global:Extranet.UserName)-->
<!--@If Defined(Ecom:Product.ImageLarge.Clean)-->There is a large image
<!--@Else-->no image

<!--@If Not Defined(Ecom:Product.ImageLarge.Clean)--> no image

See also

Read about If LoopDefined or If statements.