This document provides a complete reference for all PAD tags, grouped by functionality.
Conditional execution based on expression evaluation.
{if $condition}
Content shown if condition is true
{elseif $other_condition}
Content shown if other condition is true
{else}
Content shown if all conditions are false
{/if}
Parameters:
Supports: {elseif} and {else} clauses
Switch-case style conditional based on value matching.
{case $value}
{when 'option1'}Content for option1
{when 'option2'}Content for option2
{when 'default'}Default content
{/case}
Parameters:
Supports: Multiple {when} clauses
Rotating switch that cycles through options on each call.
{switch 'name', 'odd', 'even'}
Parameters:
Returns: Next value in rotation sequence
Loop while condition is true.
{while $condition}
Loop content
{/while}
Parameters:
Behavior: Continues iterating while condition evaluates to true
Loop until condition becomes true.
{until $condition}
Loop content
{/until}
Parameters:
Behavior: Continues iterating while condition is false (opposite of while)
Set one or more global variables.
{set name='value', count=5, active=TRUE}
Parameters:
Note: Cannot be used as open/close tag pair
Retrieve content from the content store or include files.
{get 'content_name'}
Parameters:
Returns: Retrieved content
Store data to the data store for iteration.
{data 'store_name'}
Content to iterate
{/data}
Parameters:
Behavior: Stores data and iterates over it
Store content to the content store.
{content 'store_name'}
Content to store
{/content}
Parameters:
Store boolean value to store.
{bool 'store_name'}
Parameters:
Database record access tags.
{field 'tablename fieldname'}
{array 'tablename'}
{record 'SQL query'}
Parameters:
Returns: Database query results
Check if array/data has elements.
{count $arrayName}
Has elements
{/count}
Parameters:
Returns: TRUE if has elements, FALSE if empty
Increment a variable by 1.
{increment $counter}
Parameters:
Behavior: Creates variable with value 1 if doesn’t exist
Decrement a variable by 1.
{decrement $counter}
Parameters:
Behavior: Creates variable with value -1 if doesn’t exist
Include and execute a PAD page.
{page 'pagename'}
Parameters:
Behavior: Executes the page’s PHP and PAD files
Execute PHP code.
{code 'phpfile'}
Parameters:
Note: Content is cleared before execution
Execute code in isolated sandbox.
{sandbox 'phpfile'}
Parameters:
Behavior: Same as code but in sandbox mode
Execute a sequence action.
{action 'action_name'}
Parameters:
Handle AJAX request.
{ajax 'handler'}
Parameters:
Generic PAD include tag.
{pad data='source'}
Template content
{/pad}
Behavior: Processes PAD template with data
Redirect to another URL.
{redirect 'url'}
Parameters:
Behavior: Performs HTTP redirect
Restart PAD processing with new page.
{restart 'pagename', param1='value1'}
Parameters:
List files in a directory with filtering options.
{files 'directory', mask='*.txt', recursive=TRUE}
{$path} - {$file}
{/files}
Parameters:
dir / first param: Directory pathmask: File pattern (e.g., *.txt)onlyFiles: Only return filesonlyDirs: Only return directoriesrecursive: Include subdirectoriesexclude: Exclusion patternincludeHidden: Include hidden filesbase: Base path (app, data, pad, or absolute)group: Group results by item nameReturns: Array with path, file, ext, item, dir for each entry
Simple directory listing.
{dir '/path/to/directory'}
Parameters:
Returns: Array of filenames (via scandir)
Write content to file.
{file dir='path', name='filename', ext='txt'}
File content
{/file}
Parameters:
dir: Directory pathname: Filename (default: ‘file’)ext: Extension (default: ‘ext’)date: Include date in filenamestamp: Include timestampid: Include unique IDCheck if file exists.
{exists '/path/to/file'}
Parameters:
Returns: TRUE if file exists, FALSE otherwise
Return opening brace character.
{open}
Returns: &open; (entity for {)
Return closing brace character.
{close}
Returns: &close; (entity for })
Make HTTP request.
{curl 'http://example.com', method='POST', data='payload'}
Parameters:
url / first param: URL to requestSELF:// prefix replaced with current hostBehavior: Makes HTTP request, throws error if result is not 200
Returns: Response data
Evaluate and output expression.
{echo $variable}
{echo '5 + 3'}
Parameters:
Returns: Evaluated result
Set output type.
{output 'download'}
Parameters:
web, console, file, download)Format/beautify HTML content.
{tidy}
<html>content</html>
{/tidy}
Behavior: Applies HTML tidying to content
Escape PAD syntax in content.
{ignore}
{this is not processed}
{/ignore}
Behavior: Escapes content so PAD tags are not processed
Dump debug information.
{dump}
Behavior: Calls padDump() with message
Enable detailed tracing.
{trace}
Code to trace
{/trace}
Behavior: Enables trace mode for enclosed content
Trigger a PAD error.
{error 'Error message'}
Parameters:
Behavior: Calls padError() with message
Throw PHP exception.
{exception 'Exception message'}
Parameters:
Behavior: Throws PHP Exception
Exit PAD processing.
{exit}
Behavior: Calls padExit() to terminate processing
Return TRUE value.
{true}
Returns: TRUE
Return FALSE value.
{false}
Returns: FALSE
Return NULL value.
{null}
Returns: NULL
Generate mathematical sequences.
{sequence prime, rows=10}
{sequence fibonacci, from=1, to=100}
{sequence '1..10'}
Parameters: See sequence subsystem documentation for full parameter list.
Returns: Generated sequence array
Skip to next iteration of a loop.
{continue 'tagname'}
Parameters:
Behavior: Skips to next iteration (like PHP’s continue)
Soft stop - graceful end of loop.
{cease 'tagname'}
Parameters:
Behavior: Gracefully ends loop processing
Hard stop - immediate exit from loop.
{break 'tagname'}
Parameters:
Behavior: Immediately exits loop (like PHP’s break)
Pull stored sequence data.
{pull 'stored_name'}
Parameters:
Set sequence flag.
{flag}
Behavior: Used within sequence processing
Keep sequence values matching criteria.
{keep}
Behavior: Filter to keep matching values
Remove sequence values matching criteria.
{remove}
Behavior: Filter to remove matching values
Transform sequence values.
{make}
Behavior: Transform values during sequence generation
| Tag | Category | Description |
|---|---|---|
if |
Control Flow | Conditional execution |
case |
Control Flow | Switch-case matching |
switch |
Control Flow | Rotating value switch |
while |
Control Flow | Loop while true |
until |
Control Flow | Loop until true |
set |
Variables | Set global variables |
get |
Variables | Get stored content |
data |
Variables | Store/iterate data |
content |
Variables | Store content |
bool |
Variables | Store boolean |
field |
Database | Query field |
array |
Database | Query array |
record |
Database | Execute SQL |
count |
Counters | Check element count |
increment |
Counters | Increment variable |
decrement |
Counters | Decrement variable |
page |
Execution | Include PAD page |
code |
Execution | Execute PHP |
sandbox |
Execution | Sandboxed PHP |
action |
Execution | Execute action |
ajax |
Execution | AJAX handler |
pad |
Execution | PAD include |
redirect |
Navigation | HTTP redirect |
restart |
Navigation | Restart processing |
files |
Files | List files |
dir |
Files | Directory listing |
file |
Files | Write file |
exists |
Files | Check file exists |
open |
Files | Opening brace |
close |
Files | Closing brace |
curl |
Network | HTTP request |
echo |
Output | Evaluate/output |
output |
Output | Set output type |
tidy |
Output | Format HTML |
ignore |
Output | Escape content |
dump |
Debug | Dump info |
trace |
Debug | Enable tracing |
error |
Errors | Trigger error |
exception |
Errors | Throw exception |
exit |
Errors | Exit processing |
true |
Values | Return TRUE |
false |
Values | Return FALSE |
null |
Values | Return NULL |
sequence |
Sequences | Generate sequence |
continue |
Loop Control | Skip to next iteration |
cease |
Loop Control | Soft stop (graceful end) |
break |
Loop Control | Hard stop (immediate exit) |
pull |
Sequences | Pull stored data |
flag |
Sequences | Set flag |
keep |
Sequences | Keep matching |
remove |
Sequences | Remove matching |
make |
Sequences | Transform values |
Resolve naming conflicts with explicit prefixes:
| Prefix | Purpose | Example |
|---|---|---|
app: |
App tag from _tags/ |
{app:mytag} |
pad: |
Built-in PAD tag | {pad:if} |
php: |
Call PHP function | {php:strlen(@)} |
function: |
Custom PAD function | {$x \| function:myfunc} |
data: |
Defined data block | {data:items} |
content: |
Content block | {content:header} |
pull: |
Stored sequence | {pull:mySeq} |
field: |
Database field | {field:"name from users"} |
table: |
Database table | {table:users} |
local: |
Files from _data/ |
{local:menu.json} |
constant: |
PHP constant | {constant:PHP_VERSION} |
bool: |
Boolean store | {bool:isAdmin} |
array: |
Access array as loop | {array:items} |
action: |
Sequence action | {action:reverse} |
Options modify tag behavior. Add them to any tag.
| Option | Direction | Description |
|---|---|---|
data |
Input | Get data from source |
content |
Input | Get content from store |
toData |
Output | Store data to variable |
toContent |
Output | Store content to variable |
toBool |
Output | Store boolean flag |
| Option | Description |
|---|---|
bool |
Check/create boolean flag |
optional |
Suppress not-found errors |
demand |
Mark as required |
null |
Alternative for NULL |
else |
Alternative for empty/false |
notOk / error |
Alternative for error |
| Option | Description | Example |
|---|---|---|
quote |
Wrap in quotes | quote="'" |
open |
Prefix on first | open="[" |
close |
Suffix on last | close="]" |
glue |
Separator | glue=", " |
tidy |
Clean whitespace |
| Option | Description |
|---|---|
sort |
Sort data |
rows |
Limit rows |
first |
First N items |
last |
Last N items |
page |
Pagination |
cache |
Cache output |
callback |
Run callback |
ignore |
Skip PAD processing |
noError |
Suppress errors |
dump |
Debug output |
{list quote="'" glue=", " open="[" close="]"}
Result: ['item1', 'item2', 'item3']
Access iteration state and metadata using property@tag syntax.
| Property | Description |
|---|---|
first@tag |
Is first iteration |
last@tag |
Is last iteration |
notFirst@tag |
Is NOT first |
notLast@tag |
Is NOT last |
border@tag |
Is first OR last |
middle@tag |
Is neither first nor last |
even@tag |
Is even occurrence |
odd@tag |
Is odd occurrence |
| Property | Description |
|---|---|
current@tag |
Current occurrence (1-based) |
count@tag |
Total items |
remaining@tag |
Items remaining |
done@tag |
Items completed |
| Property | Description |
|---|---|
key@tag |
Current array key |
keys@tag |
All keys with values |
fields@tag |
Field name/value pairs |
data@tag |
Full data array |
firstFieldName@tag |
First field’s name |
firstFieldValue@tag |
First field’s value |
| Property | Description |
|---|---|
name@tag |
Tag name |
parameter:x@tag |
Named parameter |
parameters@tag |
All parameters |
option:n@tag |
Positional option |
options@tag |
All options |
variable:x@tag |
Level variable |
variables@tag |
All variables |
{items}
{if first@items}<ul>{/if}
<li class="{even@items ? even : odd}">{$name}</li>
{if last@items}</ul>{/if}
Index: {current@items} of {count@items}
{/items}