App: manual - Page: fragments/expressions_12
PHP
|
HTML
fragments/expressions_12.pad
|
Result
|
|
{data 'colors'}["red", "green", "blue"]{/data} {set $nums = [4, 8, 15]} {set $title = 'Prefixes'} <p>{echo constant:PHP_INT_SIZE}</p> <p>{echo php:count(data:colors)}</p> <p>{echo php:count(array:nums)} numbers, together {echo array:nums + 0}</p> <p>{echo php:str_repeat('=', 5)}</p> <p>{echo field:title | upper}</p>
|
|
App: manual - Page: fragments/expressions_30
App: manual - Page: fragments/expressions_33
PHP
|
HTML
fragments/expressions_33.pad
|
Result
|
|
<p>{echo 'well done' | stars}</p> <p>{echo 'well done' | function:stars}</p> <p>{echo 'well done' | upper | stars | php:strlen}</p>
|
|
App: manual - Page: fragments/expressions_34
App: manual - Page: fragments/expressions_37
App: manual - Page: fragments/expressions_39
App: manual - Page: fragments/expressions_4
PHP
|
HTML
fragments/expressions_4.pad
|
Result
|
|
{set $name = ' ada lovelace '} <p>{$name | trim | ucwords}</p> {data 'langs'}["php", "sql", "pad"]{/data} <p>{langs}{$langs} {/langs | upper}</p>
|
|
App: manual - Page: fragments/expressions_40
PHP
|
HTML
fragments/expressions_40.pad
|
Result
|
|
{set $html = '<i>pad</i>'} <p>{$html | upper}</p> <p>{echo $html | upper}</p>
|
|
App: manual - Page: fragments/expressions_8
PHP
fragments/expressions_8.php
|
HTML
fragments/expressions_8.pad
|
Result
|
<?php
$user = [ 'name' => 'Ada', 'address' => [ 'city' => 'London', 'zip' => 'W1' ] ]; $langs = [ 'PHP', 'SQL', 'PAD' ];
?>
|
<p>{echo $user.name . ' from ' . $user.address.city}</p> <p>{echo $langs.0} and {echo $langs.2}</p> <p>{$user.address.city | upper}, {$user.address.zip}</p>
|
|
App: manual - Page: fragments/extending_2
PHP
|
HTML
fragments/extending_2.pad
|
Result
|
|
<p>{echo 'well done' | stars}</p> <p>{echo 'well done' | upper | stars}</p>
|
|
App: manual - Page: fragments/pipes_1
PHP
fragments/pipes_1.php
|
HTML
fragments/pipes_1.pad
|
Result
|
<?php
$name = 'john doe'; $email = 'ALICE@EXAMPLE.COM'; $price = 1234.56;
?>
|
<p>Original: {$name}</p> <p>Uppercase: {echo $name | upper}</p> <p>Capitalize: {echo $name | ucwords}</p>
<p>Original: {$email}</p> <p>Lowercase: {echo $email | lower}</p>
<p>Original: {$price}</p> <p>Formatted: {echo $price | number_format(@, 2)}</p>
|
|
App: manual - Page: fragments/pipes_2
PHP
fragments/pipes_2.php
|
HTML
fragments/pipes_2.pad
|
Result
|
<?php
$items = ['apple', 'banana', 'cherry'];
?>
|
<p>Items separated by commas:</p> <p>{items print, glue=", "}</p>
<p>Items in uppercase:</p> <ul> {items} <li>{$items}</li> {/items | upper} </ul>
|
|
App: manual - Page: fragments/pipes_3
PHP
fragments/pipes_3.php
|
HTML
fragments/pipes_3.pad
|
Result
|
<?php
$rawText = ' hello world '; $message = 'the quick brown fox';
?>
|
<p>Chain multiple pipes together:</p>
<p>Original: [{$rawText}]</p> <p>Trimmed and uppercase: [{echo $rawText | trim | upper}]</p>
<p>Original: {$message}</p> <p>Uppercase first letter of each word: {echo $message | ucwords}</p> <p>Replace and capitalize each word: {echo $message | replace('fox', 'dog') | ucwords}</p>
|
|
App: manual - Page: fragments/pipes_4
PHP
|
HTML
fragments/pipes_4.pad
|
Result
|
|
{data 'words'}("alpha","beta"){/data}
<p>Closing tag pipe - handed everything the tag rendered: [{words}{$words} {/words | upper}]</p> <p>Opening tag pipe - handed the content template, which then repeats: [{words | upper}row {/words}]</p>
|
|
App: regression/common - Page: misc/eval
|