This document provides a complete reference for all PAD tag types.
Every PAD tag has a type that determines how it’s processed. Types are automatically detected based on the tag name, or can be explicitly specified using the type:name syntax.
{tagName}
PAD automatically detects the type based on what tagName matches.
{type:name}
Explicitly specify the type for disambiguation.
Examples:
{users} ← Auto-detected as 'select' type (if declared in $padSelect)
{select:users} ← Explicitly specified as select type
{field:username} ← Explicitly field type
{php:strtoupper 'abc'} ← Explicitly PHP function type
When no explicit type is given, PAD checks in this order (see padTypeTag() and padTypeCommon() in PAD/lib/type.php):
_tags/ directories_common appPAD/tags/trim, date, substr …) runs as the pipe functionA field or array that exists only as a request value - a GET, POST or cookie value the page’s PHP
(its configuration, _inits.php, the page, _exits.php) does not name, held by no row - comes
after all of them: a visitor’s ?prime=x never takes the
place of the sequence, constant, _data file or function the template names, and is the field
only when the template means nothing else by the name.
Loads application-specific tags from _tags/ in the page’s directory or a parent’s, up to the
application root.
{myCustomTag}
{app:myCustomTag}
Resolution: Checks padAppTagCheck() for tag in application directory.
Files loaded:
_tags/myCustomTag.php - PHP logic_tags/myCustomTag.pad - PAD templateUse case: Application-specific custom tags.
Loads built-in PAD tags from the PAD/tags/ directory.
{if}
{pad:if}
Resolution: PAD/tags/{tagName}.php or .pad
Files loaded:
PAD/tags/{name}.php - PHP logicPAD/tags/{name}.pad - PAD templateUse case: Core PAD framework tags.
Loads shared tags from the apps/_common/ application.
{padFrame}
{common:padFrame}
Resolution: padCommonCheck() - checked after app, before pad, so a common tag overrides a built-in of the same name but not an app-local one. Can be disabled per app with $padCommon = FALSE.
Use case: Tags shared by all applications - the frame of the PAD applications, {example}, {demo}, {table}.
Retrieves data from the data store ($padDataStore).
{data:myData}
{myData} ← If myData exists in data store
Resolution: $padDataStore[$tagName]
Options:
print - Output with formattingExample:
{users toData="activeUsers"}
{data:activeUsers}
Retrieves content from the content store ($padContentStore).
{content:header}
Resolution: $padContentStore[$tagName]
Example:
{header toContent="savedHeader"}
{content:savedHeader}
Retrieves boolean values from the boolean store ($padBoolStore).
{bool:isAdmin}
Resolution: $padBoolStore[$tagName]
Returns: The stored boolean value.
Example:
{checkAdmin toBool="isAdmin"}
{if bool:isAdmin}...{/if}
Retrieves field values from the current data context.
{field:username}
{$username} ← Shorthand for field
Resolution: padFieldValue($tagName)
Returns: Field value, or NULL if field is null.
Example:
{users}{field:email}{/users}
{users}{$email}{/users} ← Equivalent
Retrieves tag properties from parent tags.
{property:current}
{¤t} ← Shorthand for property
Resolution: padTagValue($tagName)
Supports: Parameter prefixing with $padParm.
Example:
{users}{¤t}{/users}
Retrieves array values by name.
{array:myArray}
Resolution: padArrayValue($tagName)
Use case: Access named arrays in the current context.
Retrieves a parameter or option of the tag directly around it - an {if} or {case} in
between is skipped, any other tag is not: inside {users mode="fast"}{orders} the {orders} is
asked, and has no mode.
{users mode="fast"}{parm:mode}{/users}
Resolution: padOptValue($tagName, 1)
Retrieves an array field of an enclosing row - the nearest level outward that holds one - and iterates it.
{orders}{level:lines}{$product}{/level:lines}{/orders}
Resolution: padGetLevelArray($tagName)
Use case: Walk a nested array of the row being rendered. A {tag $name = value} level
variable is not what it reads.
Retrieves PHP constants by name.
{constant:PHP_VERSION}
{constant:APP}
Resolution: constant($tagName)
Returns: The value of the PHP constant.
Example:
{constant:PHP_EOL}
{constant:TRUE}
Loads local data files with automatic type detection.
{local:users.json}
{myfile} ← _data/myfile.csv, the extension found for it
Resolution: padDataFileName($tagName) - a file directly in _data/ (a name holds no /),
with its extension or with the first of .xml, .json, .yaml, .csv, .php, .curl,
.sql that exists; a bare tag is written without the extension.
Supported formats:
.php - Executes PHP and returns result.json - Parsed as JSON.yaml - Parsed as YAML.csv - Parsed as CSV.xml - Parsed as XML.curl - Fetches the URL it names.sql - Runs the named querytype= names the formatOptions:
name - Override data nametype - Override file typesandbox - Enable sandboxed processingExample:
{local:settings.json}
{local:data.csv name='myData', type='csv'}
Includes content from application include files.
{include:header}
Resolution: padAppIncludeCheck($tagName)
Returns: Included file content.
Queries database tables declared in the PAD Select subsystem.
{select:users}
{users} ← If 'users' is declared in $padSelect
Resolution: isset($padSelect[$tagName]) - tables are declared in the app’s _lib/select.php via $padSelect (and relations via $padRelations).
Returns: Query results as iterable data; nested select tags join automatically through $padRelations.
Example:
{users $id=5}
{$username}
{/users}
See DATABASE.md for the full Select subsystem reference.
Executes PAD functions as tags.
{function:trim}content{/function:trim}
{trim}content{/trim}
Resolution: padFunctionAsTag($tagName)
Behavior:
Example:
{upper}hello{/upper} → HELLO
{replace 'a', 'b'}aaa{/replace} → bbb
Calls PHP built-in functions directly.
{php:strtoupper 'hello'}
{php:date 'Y-m-d'}
Resolution: function_exists($tagName)
Implementation: call_user_func_array($tagName, $parameters)
Example:
{php:strlen 'hello'} → 5
{php:array_sum [1,2,3]} → 6
Executes external shell scripts.
{script:myscript}
{script:processor 'arg1', 'arg2'}
Resolution: padScriptCheck($tagName) - _scripts/<name>, or _scripts/<name>.<ext>, from
the page’s directory up to the application root.
Features:
escapeshellarg()Returns: Script output (stdout).
These types integrate with the PAD sequence subsystem.
Accesses sequence type definitions.
{sequence:fibonacci}
Resolution: file_exists(PT . $tagName)
Implementation: Delegates to PQ/start/types/sequence.php.
Executes sequence actions.
{action:sum}
{mySequence:sum}
Resolution: file_exists(PQ/actions/types/$tagName.php)
Implementation: Delegates to PQ/start/types/action.php.
Retrieves values from the sequence store.
{pull:mySequence}
{mySequence} ← If exists in pqStore
Resolution: isset($pqStore[$tagName])
Implementation: Delegates to PQ/start/types/pull.php.
Turns each value of a sequence into 1 or 0: whether it belongs to the named sequence type.
{flag:prime}
{mySeq:flag even}
Resolution: padTypeSeq() - a sequence type or a stored sequence.
Implementation: Delegates to PQ/start/types/flag.php. (In an expression, flag:name
reads the bool store instead.)
Creates new sequence values.
{make:fibonacci}
{fibonacci:make}
Resolution: Sequence exists + make type available.
Implementation: Delegates to PQ/start/types/make.php.
Keeps only the values the named sequence type accepts; nothing is stored.
{keep:mySequence even}
Implementation: Delegates to PQ/start/types/keep.php.
Drops the values the named sequence type accepts; no store is dropped.
{remove:mySequence even}
Implementation: Delegates to PQ/start/types/remove.php.
| Type | Source | Description |
|---|---|---|
app |
App _tags/ |
Application-specific tags |
common |
apps/_common/ | Shared tags |
pad |
PAD/tags/ | Built-in PAD tags |
data |
$padDataStore | Stored data arrays |
content |
$padContentStore | Stored content strings |
bool |
$padBoolStore | Boolean flags |
field |
Current data | Field values |
property |
Parent tag | Tag properties |
array |
Arrays | Named arrays |
parm |
Enclosing tag | Parameter/option value |
level |
Enclosing rows | Nested array field |
constant |
PHP | PHP constants |
local |
Files | Local data files |
include |
APP | Include files |
select |
$padSelect | Declared select tables |
function |
PAD/functions/ | PAD functions |
php |
PHP | PHP functions |
script |
Scripts | Shell scripts |
sequence |
PQ | Sequence types |
action |
PQ | Sequence actions |
pull |
pqStore | Sequence values |
flag |
PQ | Membership flags, 1 or 0 |
make |
PQ | Sequence creation |
keep |
PQ | Filter: keep the matches |
remove |
PQ | Filter: drop the matches |
Each type has a corresponding handler in PAD/types/:
types/
├── action.php → Sequence action
├── app.php → Application tag
├── array.php → Array value
├── bool.php → Boolean store
├── common.php → Shared _common tag
├── constant.php → PHP constant
├── content.php → Content store
├── data.php → Data store
├── field.php → Field value
├── flag.php → Sequence membership flags
├── function.php → PAD function
├── include.php → Include file
├── keep.php → Sequence keep
├── level.php → Array field of an enclosing row
├── local.php → Local file
├── make.php → Sequence make
├── pad.php → PAD tag
├── parm.php → Tag parameter
├── php.php → PHP function
├── property.php → Tag property
├── pull.php → Sequence pull
├── remove.php → Sequence remove
├── script.php → Shell script
├── select.php → Select table query
├── sequence.php → Sequence type
└── _go/
├── local.php → Local file processing
└── tag.php → Tag file loading
{users where='$active eq 1', toData='activeUsers'}
{if data:activeUsers}
<h2>Active Users ({php:count data:activeUsers})</h2>
{data:activeUsers}
<div>{field:name} - {field:email}</div>
{/data:activeUsers}
{else}
<p>No active users</p>
{/if}
<footer>{constant:PHP_VERSION}</footer>
{-- 'date' could be a field, function, or PHP function --}
{field:date} ← Get date field value
{function:date} ← Use PAD date function
{php:date 'Y-m-d'} ← Use PHP date function
{fibonacci:make rows=10, push='fib'}{/fibonacci:make}
{fib:sum}{$sequence}{/fib:sum}
{pull:fib}{$sequence} {/pull:fib}
{fib:remove even}{$sequence} {/fib:remove}