This document provides a complete reference for all PAD constructs - special @something@ markers used in PAD templates.
PAD constructs are special placeholder markers that control template structure and content flow. They use the @name@ syntax and are processed during template building and rendering.
@pad@
@content@
@start@
@end@
@self@
@page@
@tidy@
The main content placeholder that marks where page content should be inserted.
Purpose: Central insertion point for page content in the template hierarchy.
Usage:
<!DOCTYPE html>
<html>
<head><title>My App</title></head>
<body>
@pad@
</body>
</html>
Behavior:
_inits.pad and _exits.pad files to wrap page content@pad@ is replaced with the actual page content@pad@Build Process:
@pad@ as the base_inits.pad and _exits.pad wrap around it@pad@Example with Init/Exit:
<!-- _inits.pad -->
<html><body>
@pad@
<!-- _exits.pad -->
</body></html>
<!-- Result: <html><body> [page content] </body></html> -->
Page-level placeholder, converted to @pad@ during build.
Purpose: Alternative marker for page content, normalized to @pad@.
Usage:
<div class="page-wrapper">
@page@
</div>
Behavior:
@pad@ during the build process@pad@ after conversionContent merge placeholder for inserting content into parent templates.
Purpose: Marks where child content should be merged into parent content.
Usage:
<!-- Parent template -->
<article>
<header>Article Header</header>
@content@
<footer>Article Footer</footer>
</article>
Behavior:
padContentBeforeAfter() finds @content@ to split templates@content@ becomes the prefix@content@ becomes the suffix@content@ positionMerge Options:
merge="top" - Insert at top of content areamerge="bottom" - Insert at bottom of content area@content@ marker positionStart marker that splits content for deferred processing.
Purpose: Marks the beginning of a section that should be processed after initial content.
Usage:
{myTag}
<header>Always shown</header>
@start@
<main>Shown after data processing</main>
{/myTag}
Behavior:
padOpenCloseOk() function$padBase into two parts at the @start@ marker@start@ is processed immediately@start@ is stored in $padStartBase for later processingUse Cases:
End marker that splits content for pre-processing.
Purpose: Marks content that should be processed before the main content ends.
Usage:
{myTag}
<main>Main content</main>
@end@
<footer>Processed before tag closes</footer>
{/myTag}
Behavior:
padOpenCloseOk() function$padBase at the @end@ marker@end@ is the main content@end@ is stored in $padEndBaseUse Cases:
Self-referential marker that inserts the current page path.
Purpose: Provides a way to reference the current page within templates.
Usage:
<form action="@self@" method="post">
<!-- Form submits to current page -->
</form>
<a href="@self@?refresh=1">Refresh</a>
Behavior:
$padGo . $padPage (current page path)Example Replacement:
@self@ → /myapp/users/edit
Tidy marker that triggers HTML output formatting.
Purpose: Signals that HTML tidying should be applied to the output.
Usage:
@tidy@
<html>
<head><title>Page</title></head>
<body>
<div><p>Content</p></div>
</body>
</html>
Behavior:
@tidy@ in output triggers HTML tidyingexits/tidy.php: strpos($padOutput, '@tidy@')$padTidy variableTidying Effects:
| Construct | Purpose | Replaced With |
|---|---|---|
@pad@ |
Main content placeholder | Page content |
@page@ |
Page placeholder (alias) | Converted to @pad@ |
@content@ |
Content merge point | Child content |
@start@ |
Deferred section start | Split marker |
@end@ |
Pre-closure section | Split marker |
@self@ |
Current page reference | Page path |
@tidy@ |
HTML formatting trigger | Removed (triggers tidy) |
Each construct has a validation file in PAD/constructs/:
| File | Construct | Purpose |
|---|---|---|
pad.php |
@pad@ |
Validates pad construct |
page.php |
@page@ |
Validates page construct |
content.php |
@content@ |
Validates content construct |
start.php |
@start@ |
Validates start construct |
end.php |
@end@ |
Validates end construct |
self.php |
@self@ |
Validates self construct |
tidy.php |
@tidy@ |
Validates tidy construct |
All validation files return TRUE to indicate the construct is recognized and valid.
_inits.pad:
<!DOCTYPE html>
<html>
<head>
<title>{$pageTitle}</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<nav>{include:navigation}</nav>
<main>
@pad@
_exits.pad:
</main>
<footer>{include:footer}</footer>
</body>
</html>
Parent template (layout.pad):
<div class="container">
<aside class="sidebar">{include:sidebar}</aside>
<article class="content">
@content@
</article>
</div>
Child content:
<h1>Page Title</h1>
<p>Page content goes here...</p>
<form action="@self@" method="post">
<input type="text" name="search" value="{$search}">
<button type="submit">Search</button>
</form>
{users}
{-- Header processed first --}
<table>
<tr><th>Name</th><th>Email</th></tr>
@start@
{-- Rows processed with data --}
<tr><td>{$name}</td><td>{$email}</td></tr>
@end@
{-- Footer processed last --}
</table>
<p>Total: {@count} users</p>
{/users}
{if $debug}
@tidy@
{/if}
<html>
<!-- HTML will be tidied only in debug mode -->
</html>
@page@ → @pad@ conversion@pad@@pad@ replaced with page content@start@ and @end@ splitting@content@ merging@self@ replacement@tidy@ detection and HTML tidying