A Complete Guide to Tokens and Conditional Logic in DirectAdmin Templates and Skins

This article explains which tokens are available inside DirectAdmin templates and skins, how to use the special |DUMPTOKENS| token to inspect all available variables, and how to implement logical operations such as AND, OR, and elseif using DirectAdmin’s template syntax. These techniques help developers customize templates, skins, and configuration files with precision.

DirectAdmin tokenstemplate logic, DUMPTOKENSDirectAdmin skin development

~2 min read · Updated Mar 1, 2026

1. Available Tokens in DirectAdmin Templates and Skins


When working with DirectAdmin templates, skins, or any file that uses token-based rendering, you may need to know which tokens are currently available. Some tokens are always present, while others depend on context or configuration.


DirectAdmin provides a special “magic” token for debugging:


|DUMPTOKENS|

When DirectAdmin processes a template containing this token, it outputs a complete list of all available tokens in the format:

token=value

This is extremely useful for discovering what variables you can work with.


Important: Adding |DUMPTOKENS| to configuration templates (e.g., httpd.conf) will break them. Use it only for testing and remove it immediately afterward.


For skins, plugins, or any HTML output, a common usage is:

<pre>|DUMPTOKENS|</pre>
---

2. Using Logical AND (&&) and OR (||) in Templates


DirectAdmin’s template engine is simple and does not support native logical operators. However, you can emulate AND and OR logic using nested conditions and temporary variables.


2.1 Implementing AND (&&)


Standard code:

if (A == "1" && B == "1") {
    //something
}

DirectAdmin template equivalent:

|?TRUE=1|
|*if A!="1"|
|?TRUE=0|
|*endif|
|*if B!="1"|
|?TRUE=0|
|*endif|
|*if TRUE="1"|
    //something
|*endif|

This produces the same logical behavior as A && B.


---

2.2 Implementing OR (||)


Standard code:

if (A == "1" || B == "1") {
    //something
}

DirectAdmin template equivalent:

|?TRUE=0|
|*if A="1"|
|?TRUE=1|
|*endif|
|*if B="1"|
|?TRUE=1|
|*endif|
|*if TRUE="1"|
    //something
|*endif|

This replicates A || B.


---

3. Implementing if – elseif – else Logic


Standard code:

if (A == "1") {
    //something1
}
elseif (A == "2") {
    //something2
}
else {
    //else something
}

DirectAdmin template equivalent:

|?HAVE_SOMETHING=no|

|*if A="1"|
|?HAVE_SOMETHING=yes|
//something1
|*endif|

|*if A="2"|
|?HAVE_SOMETHING=yes|
//something2
|*endif|

|*if HAVE_SOMETHING=no|
//else something
|*endif|

Note: Initializing variables and using ! correctly in comparisons is essential for accurate logic.


---

4. Best Practices When Working with Templates


  • Use |DUMPTOKENS| only for debugging and remove it afterward.
  • DirectAdmin’s template logic is simple, but with careful structuring you can build complex conditions.
  • If your template supports embedded scripting (PHP/Perl), logic becomes much easier.

Written & researched by Dr. Shahin Siami

Related Articles

Email Client Configuration & Dovecot Quota/Monitoring Guide for DirectAdmin Users

This guide explains how to configure popular email clients (iPhone Mail, Thunderbird, Gmail POP/SMTP), enable Dovecot LMTP quota warnings, and check the last login time for all email accounts on a DirectAdmin server. It includes step by step instructions, recommended IMAP/SMTP settings, and useful administrative scripts.

Continue

Troubleshooting Dovecot in DirectAdmin – Fixing IMAP Errors, Authentication Issues, and SSL Certificate Checks

Dovecot is the IMAP/POP3 server used by DirectAdmin. Sometimes users encounter errors such as “Connection dropped by IMAP server” or “unknown user” during authentication. This guide explains how to fix corrupted Dovecot indexes, understand authentication logs, hide unnecessary warnings, and manually inspect SSL certificates on IMAP ports 143 and 993.

Continue

DNS Troubleshooting in DirectAdmin – When named is Running but Domains Do Not Resolve

Sometimes the named (BIND) service runs normally, yet DNS queries fail or domains do not resolve from outside. This guide provides a complete troubleshooting workflow for checking named listeners, firewall rules, named.conf configuration, DNS propagation issues, subdomain problems, resolv.conf errors, and common Apache/Nginx misconfigurations.

Continue

Managing DNS Records in DirectAdmin – Complete Practical Guide for Administrators

DirectAdmin provides a powerful DNS management system that allows administrators to control TTL values, create SRV records, enable DNSSEC, manage subdomain delegation, automate TLSA records, and perform mass DNS updates. This guide explains all essential DNS operations in DirectAdmin with real-world examples and best practices.

Continue

DNS and Nameservers in DirectAdmin – Complete, Practical, and Professional Guide

DNS is the backbone of the internet, responsible for translating domain names into IP addresses. DirectAdmin allows you to create private nameservers (ns1/ns2), manage DNS zones, configure DNS clustering, use external DNS, and troubleshoot common issues. This guide provides a complete, clear, and practical explanation of DNS concepts and their implementation in DirectAdmin.

Continue

CustomBuild in DirectAdmin – Complete Guide to Installation, Updates, Configuration, and Advanced Customization

CustomBuild is DirectAdmin’s primary software management system. It installs, updates, configures, and rebuilds essential services such as Apache, Nginx, PHP, MariaDB/MySQL, Exim, Dovecot, FTP servers, and more. Because most components are compiled from source, CustomBuild offers exceptional flexibility, fast access to new versions, and optimized performance.

Continue