~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