Skip to main content
OCLC Support

Display Different HTML Content Based on Group Membership or Other Conditions

Symptom

  • You need to display different text in standard HTML files depending on a user's group membership or other conditions.

Applies to

  • EZproxy

Resolution

You can use conditional expressions in EZproxy HTML files to dynamically display content based on group membership. This is done using the ^{...} syntax.

Conditional Expression Format

EZproxy supports a ternary-style conditional expression:

condition ? true_result : false_result
  • Condition: A logical test, such as checking group membership.
  • True result: The content shown if the condition is true.
  • False result: The content shown if the condition is false.
^{ActiveGroupMember('group A') || ActiveGroupMember('group B') ?
'<!-- group A -->
<img width="220px" src="/public/logo-a.png">
<hr />
Access is only possible for group A. Contact X if you have any questions.'
:
'<!-- group B -->
<img src="/public/logo.png">
<hr />
Access is only possible for group B. Contact Y if you have any questions.'
}

Notes

  • Use ActiveGroupMember('groupname') to check if a user belongs to a specific group.
  • Ensure all HTML content is properly escaped if needed.

Additional information

Help pages on Expressions and Common conditions and actions

Page ID

64803