{case}Renders the one branch whose {when} matches a value, with an {else} for none.
{false}The constant FALSE: its content is skipped and its @else@ part renders instead.
{if}Renders its content only when a condition holds, with elseif and else branches.
{ifchanged}Renders its content when a value differs from the previous row of the loop around it - a heading per group.
{null}The constant NULL: its content is dropped, the @else@ part too, and a null= option fires.
{switch}Answers the next value of a rotating list on every call - striped rows without a counter.
{true}The constant TRUE: its content renders once, as a level of its own.
Loops and trees
Repeating, stopping and recursing - 8 tags
{branch}Inside a {tree}: renders its content only when the current row has children, its @else@ part for a leaf.
{break}Leaves a loop at once: the rest of the current pass is dropped and no further row follows.
{cease}Ends a loop gracefully: the current pass finishes, and no further row follows.
{continue}Skips the rest of the current pass of a loop and goes on with its next row.
{recurse}Inside a {tree}: renders the tree's body once more for the children of the current row.
{tree}Renders a tree of rows: its body for every row, and {recurse} renders it again for the row's children.
{until}Renders its content again and again until a condition becomes true.
{while}Renders its content again and again for as long as a condition holds.
Variables and stores
Setting, counting and keeping values - 8 tags
{at}Looks a value up in a data set by a path of names and conditions - the @ notation as a tag.
{bool}Reduces its content or a value to TRUE or FALSE and keeps it under a name, for a later {name} to test.
{content}Keeps a piece of template under a name instead of printing it, for a later {name} to render.
{count}Renders its content only when a named data set or page array holds at least one element.
{data}Turns its content - JSON, XML, YAML, CSV, a list or a range - into a named data set for a later tag to iterate.
{decrement}Takes one off a variable, starting it at -1 when it does not exist yet.
{increment}Adds one to a variable, starting it at 1 when it does not exist yet.
{set}Assigns one or more variables, as globals that outlive the level the tag stands in.
Database
Rows and values straight from SQL - 5 tags
{array}Runs a SQL query on the application database and repeats its content once per row.
{check}Asks the application database whether a row exists, and renders its content only when one does.
{collection}Reads a folder of Markdown files from _content/ and repeats its content once per file, the front matter as fields.
{field}Runs a SQL query on the application database and prints the single value it answers.
{record}Runs a SQL query on the application database and renders its content with the first row's columns as fields.
Pages and execution
Other pages, code and live parts - 8 tags
{ajax}Writes an empty div and a script that has the browser fetch another page into it after the page has loaded.
{code}Runs its content as PAD source in a separate engine pass and outputs what that pass produced.
{get}Fetches another page of the application over HTTP, as a second request, and inserts its output.
{live}A region of the page that re-renders on the server when something in it is clicked, submitted or changed, and swaps itself in.
{pad}A tag with no behaviour of its own: its content renders once, or per row with data=, carrying the generic options.
{page}Renders another page of the application - its PHP and its template - in place of the tag.
{restart}Abandons the page being built and renders another page in its place, in the same request.
{sandbox}Runs its content as PAD source in an isolated pass that cannot see or leave behind anything of the page.
Navigation
Redirects, page links and the site map - 3 tags
{pager}Page links for a tag written with the page option: first and last, a window round the current page, previous and next.
{redirect}Sends the browser to another page or address with a 302 and ends the request.
{sitemap}Lists the pages of the application, read from the file tree, as rows with page, url and lastmod.
Forms and security
Fields, validation, tokens and messages - 7 tags
{csrf}The hidden form field holding the CSRF token of the visitor's session, or the bare token.
{flash}The flash messages of this request - set with padFlash on the page before - one occurrence each.
{form}A form that posts back to the page, carrying the session's CSRF token and its own name, its fields refilling when it came back.
{input}A form field with its label that refills from what its form sent and shows the error validation found for it.
{nonce}This request's Content-Security-Policy nonce, for a script or style the policy lets run.
{textarea}A text area with its label that refills from what its form sent and shows the error validation found for it.
{validator}The browser's checker of the validation rules as one inline script, for a form a component draws.
Users and access
Who is logged in and what they may do - 5 tags
{auth}Renders its content when a user is logged in, with the user's row as its data, and its else half for a guest.
{can}Renders its content when the user may do something a gate decides, and its else half when not.
{cannot}Renders its content when the user may not do something a gate decides - can turned round.
{feature}Renders its content while a feature flag is on for this visitor, and its else half while it is off.
{guest}Renders its content when nobody is logged in, and its else half for a user.
Files
Reading the file system - 4 tags
{dir}Lists the names in a directory, one occurrence each - the plain version of files.
{exists}Renders its content when a file or directory is there, its else half when not.
{file}Writes its rendered content to a file under DATA/ instead of to the page.
{files}Scans a directory and iterates its entries, with path, file, ext, item and dir for each.
Network and mail
Remote data and outgoing mail - 2 tags
{curl}Fetches a URL and answers the body of the response, optionally kept in a cache for a number of seconds.
{mail}Renders a template, or its own content, to an e-mail with an HTML and a text part, and sends it.
Output control
What is sent, how and when - 15 tags
{asset}The address of a file of www/<app>/ with a version of its contents, safe behind a far-future cache header.
{cache}Keeps a named section of the page rendered for a number of seconds - the fragment cache.
{close}Writes a literal closing brace that the template engine does not read as the end of a tag.
{echo}Evaluates an expression and prints the result - the general output tag, and the one to put in front of a pipe.
{flush}Sends the page rendered so far to the browser at once, so it can load the stylesheets while a slow part below renders.
{foo}A built-in demo tag that answers a fixed line, there to show how the type prefixes resolve a name.
{ignore}Keeps PAD from reading the braces in its content as tags - for inline JavaScript, CSS, JSON and code samples.
{nocache}Marks a part of a cached page or {cache} section that renders again on every request, the hit included.
{open}Writes a literal opening brace that the template engine does not read as the start of a tag.
{output}Switches how the running request answers - a web page, the console, a file, a download, JSON or CSV.
{reactData}Writes the mount point of a React component, its data from a provider in _providers/ as JSON in an attribute.
{spaceless}Takes out the whitespace between HTML tags, and at both ends of the content.
{tidy}Rewrites the HTML it wraps as tidied, indented markup through PHP's tidy extension.
{trans}Writes the text a key has in the _lang/ catalog of the request's locale, with plural forms and substitutions.
{vite}Links the scripts and stylesheets of a Vite build by the name of their source - or the dev server while it runs.
Text and formatting
Markdown, code, diffs, dates and words - 12 tags
{attrs}Writes HTML attributes from values - quoted and escaped, a true boolean attribute bare, a false one left out.
{classes}Builds a class list from fixed names and names that are in only while their condition holds.
{countdown}The time left until a moment, in words inside a time element - ticking every second in the browser when asked.
{diff}Shows what changed between two texts - word by word in the flow of the text, or line by line in one column or side by side.
{emoji}An emoji by its GitHub or Slack shortcode, as a labelled image a screen reader names.
{excerpt}Cuts a long text to whole words with an ellipsis, centred on the first match of search words, every match marked.
{highlight}Colours source code on the server - PAD, PHP, HTML, CSS, JavaScript, JSON, YAML, SQL or shell - with optional line numbers and marked lines.
{lorem}Placeholder text - Lorem ipsum and Latin words - in words, sentences or paragraphs, the same text for the same seed.
{markdown}Renders its content, or the value of its parameter, as Markdown and writes the HTML.
{source}Shows the files behind a page as tabs, each coloured as highlight colours it - the code shown is the code that runs.
{timeago}How long ago a moment was, in words, inside a time element that keeps the exact moment as its datetime and title.
{toc}A table of contents of the page from its own rendered headings, nested and linked - filled in once the page has rendered.
Charts and codes
Charts, maps, diagrams and barcodes as SVG - 8 tags
{barcode}Draws a barcode as inline SVG - EAN-13, EAN-8, UPC-A or Code 128, encoded on the server.
{calendar}Writes a month as a calendar table with its events, or hands over its weeks and days as rows for markup of your own.
{chart}Draws a chart as inline SVG on the server - 46 kinds, from bars and lines to sankeys, maps of a hierarchy and org charts.
{diagram}Draws a flowchart or a sequence diagram from Mermaid-style lines of text, laid out on the server as inline SVG.
{map}Draws a choropleth map as inline SVG - every country coloured by a value of its row - of the world or one of its regions.
{qr}Draws a QR code as inline SVG, encoded on the server - no image library, no remote service.
{sparkline}Draws a word-sized line chart as inline SVG - no axes, the last point marked - to stand in a sentence or a table cell.
{timeline}Draws events on a time axis as inline SVG - cards above and below the axis, spans as bars, or one under the other.
Pictures and media
Avatars, icons, ratings, images and video - 11 tags
{avatar}Draws an initials avatar as inline SVG - the letters of a name in a circle coloured by a hash of it, no image needed.
{country}Writes a country's flag from its ISO 3166 code or English name, optionally with the name beside it.
{gravatar}Writes the Gravatar picture of an e-mail address as an img - only a hash of the address leaves the page - or a local avatar instead.
{icon}Writes an interface icon from PAD's own set of 79 as inline SVG, drawn in the colour of the text around it.
{identicon}Draws a GitHub-style identicon as inline SVG - a symmetric 5 by 5 pattern and a colour from a hash of the value.
{img}Writes a picture of the application's www directory as a thumbnail of the size the page shows it at, resized once with GD.
{pdf}Sends what its content renders as a PDF instead of the page - a writer in plain PHP, the standard fonts, no library.
{placeholder}Draws a grey image placeholder as inline SVG - crossing lines and the size or a text in the middle.
{progress}Writes an accessible progress bar - the native progress element, styled, with its label and percentage - or a row of step dots.
{rating}Draws a score as stars or hearts in inline SVG - whole ones filled, a part of one clipped - and says it in words.
{video}Shows a YouTube or Vimeo video as its poster with a play button, loading the player only when pressed - or a video file as a video element.
Widgets
Tabs, modals, tables and more without JavaScript - 9 tags
{accordion}Items that open and close on a click, each a details element - no JavaScript.
{carousel}Slides in a row that scrolls and snaps sideways, with arrow links and dots - no JavaScript needed.
{copy}A text in a code block with a button that copies it to the clipboard.
{datatable}Rows as a complete HTML table - formatted numbers, a totals row, sorting and paging on the server.
{jsonview}A JSON value or a PHP array as a tree that folds open and shut, coloured by type.
{modal}A dialog over the page with the button that opens it - works with and without JavaScript.
{poll}A vote among a few answers, once per visitor, then the results as bars with percentages.
{tab}One item of a tabs, accordion or carousel: its label and its content, handed to that owner.
{tabs}Panels behind a row of tabs, switched by radio buttons and CSS - no JavaScript.
Games
Boards and puzzles - 3 tags
{chess}A chess position from FEN as an SVG board, with marked squares and arrows.
{crossword}A crossword made from a list of words: a numbered SVG grid with the Across and Down clues.
{sudoku}A sudoku as a table, the givens bold - and with solve, solved on the server.
Layouts and components
Extending, blocks, slots, stacks and fragments - 12 tags
{block}A named region of a layout or wrapper - and a page's override of it.
{define}Writes a custom tag in the template itself - what a _tags/name.pad file is, without the file.
{extends}Frames the page with a layout instead of its directories' wrappers.
{fragment}A named part of the page that a request can ask for alone - for htmx and ajax swaps.
{macro}A template function: declared parameters, given in order or by name, read as fields inside its body.
{meta}The page's metadata - a title, a layout, a cache time or any value - read while the page is assembled.
{parent}Inside an overriding block: the content of the block it overrides.
{parms}Declares the parameters of a custom tag, with defaults, at the top of its template.
{push}Renders its content and adds it to a named stack, for a stack tag elsewhere in the page to print.
{shadow}The shadow root of a custom element, rendered on the server as declarative shadow DOM.
{slot}A named place in a custom tag's template - and the fill a caller gives it.
{stack}Prints everything pushed to a named stack, from above or below it in the page.
Debugging and errors
Looking inside, and stopping on purpose - 7 tags
{assert}A condition a test run holds the page to; silent everywhere else.
{debug}Shows values as a collapsible tree in the page, for a local request only, while rendering goes on.
{dump}Stops the request and shows the debug dump of the engine's state at that point.
{error}Raises a PAD error from the template, handled as the configured error action says.
{exception}Throws a real PHP exception from the template, to exercise the error handling.
{exit}Ends the request at once, with an empty body - the PAD way to stop instead of PHP's exit.
{trace}Switches the execution trace on for just the part of the page it wraps.
Sequences
Number sequences and what is done to them - 8 tags
{action}Runs one sequence action - reverse, sum, first and the rest - over a store, a range or a type, and iterates the result.
{flag}Replaces every value of a sequence with 1 or 0: whether it belongs to a sequence type.
{keep}Keeps only the values of a sequence that belong to a sequence type.
{make}Replaces every value of a sequence with what a sequence type makes of it.
{pull}Iterates a stored sequence, optionally through plays and actions.
{remove}Removes the values of a sequence that belong to a sequence type - the inverse of keep.
{resume}Transforms the sequence pushed last, in place, through an action or a play.
{sequence}Generates a range, a list or one of 80 mathematical sequences, and iterates its values.