App: demo - Page: todo
PHP
todo.php
|
HTML
todo.pad
|
Result
|
<?php
$title = 'Todo List'; $dataFile = 'demo/todos.json'; // under DATA/, for padFileGet and padFilePut $message = $message ?? ''; // todoPost sets it, then restarts this page
// A notice from the request - ?todo&message[]=x - is no text: {if $message} ended the // page on a 500 over the list.
if ( ! is_string ( $message ) ) $message = '';
$todos = json_decode ( padFileGet ( $dataFile ), TRUE ) ?: [];
$hasTodos = count ( $todos ) > 0; $doneCount = count ( padArrWhere ( $todos, 'done' ) ); $pendingCount = count ( $todos ) - $doneCount;
?>
|
<p>Manage your tasks with this simple todo list.</p>
{if $message} <div class="message">{$message}</div> {/if}
<h2>Add New Task</h2>
{todo 'add', 'Add Task'} <input type="text" name="task" aria-label="New task" placeholder="Enter a new task..." required style="flex: 1;"> {/todo}
<h2>Tasks ({$pendingCount} pending, {$doneCount} done)</h2>
{todos}
<table>
<tr> <th>Task</th> <th style="width: 120px;">Added</th> <th style="width: 5%; text-align: center;" colspan="2">Actions</th> </tr>
@start@
<tr{if $done} class="todo-item done"{/if}> <td>{$task}</td> <td style="font-size: 12px; color: #999;">{$date | substr (0, 10)}</td> <td> {if ! $done} {todo 'done', 'Done'} <input type="hidden" name="id" value="{$id}"> {/todo} {/if} </td> <td> {todo 'delete', 'Delete'} <input type="hidden" name="id" value="{$id}"> {/todo} </td> </tr>
@end@
</table>
{if $doneCount > 0} {todo 'clear', 'Clear Completed Tasks'}{/todo} {/if} @else@
<p>No tasks yet. Add one above!</p>
{/todos}
|
|
App: manual - Page: lvl_occ/9
PHP
|
HTML
lvl_occ/9.pad
|
Result
|
|
{data 'myJson'} [ { "column": [ 11, 12, 13, 14, 15 ] }, { "column": [ 21, 22, 23, 24, 25 ] }, { "column": [ 31, 32, 33, 34, 35 ] } ] {/data}
{pad data='myJson'} <table border='1'> @start@ <tr> {column} <td>{$column}</td> {/column} </tr> @end@ </table> {/pad}
|
|
App: manual - Page: pages/start_end
App: manual - Page: php_and_html/z12
PHP
php_and_html/z12.php
|
HTML
php_and_html/z12.pad
|
Result
|
<?php
return [ 1 => [ 'hi' => 2 ], 2 => [ 'hi' => 3 ], 3 => [ 'hi' => 4 ] ];
?>
|
<h3>Hello World 1</h3>
@start@ <h3>Hello World {$hi}</h3> @end@
<h3>Hello World 5 </h3>
|
|
App: manual - Page: php_and_html/z25
PHP
php_and_html/z25.php
|
HTML
php_and_html/z25.pad
|
Result
|
<h3>Hello World 1</h3>
<?php
$hi = 'Hello World 7';
echo '<h3>Hello World 2</h3>';
return [ 88 => [ 'hi' => 4 ], 12 => [ 'hi' => 5 ], 33 => [ 'hi' => 6 ] ];
?>
|
<h3>Hello World 3</h3>
@start@ <h3>Hello World {$hi}</h3> @end@
<h3>{$hi}</h3>
<h3>Hello World 8 </h3>
|
|
App: regression/common - Page: manual/3_ways_to_make_a_table
App: regression/errors - Page: syntax/an_end_needs_its_start
PHP
|
HTML
syntax/an_end_needs_its_start.pad
|
Result
|
|
{data 'u'}[1,2]{/data}{u}{$u} @end@ done{/u}
|
|
App: regression/errors - Page: syntax/the_sections_stand_in_order
PHP
|
HTML
syntax/the_sections_stand_in_order.pad
|
Result
|
|
{data 'u'}[1,2]{/data}{u}a @end@ b @start@ c{/u}
|
|
App: regression/framework - Page: check/options_sort
PHP
|
HTML
check/options_sort.pad
|
Result
|
|
{content 'myContent'} <table border=1> <tr> <th> volume </th> <th> edition </th> <th> file </th> </tr> @start@ <tr> <td> {$volume} </td> <td> {$edition} </td> <td> {$file} </td> </tr> @end@ </table> {/content}
{data 'myData'} [ { "volume": 55, "edition": 3, "file": "file1.xml" }, { "volume": 33, "edition": 1, "file": "file2.xml" }, { "volume": 55, "edition": 2, "file": "file11.xml" }, { "volume": 33, "edition": 3, "file": "file12.xml" }, { "volume": 55, "edition": 1, "file": "file21.xml" }, { "volume": 33, "edition": 2, "file": "file8.xml" } ] {/data}
{myContent data='myData'} {myContent data='myData', sort='volume;edition'} {myContent data='myData', sort='volume DESC; edition DESC'} {myContent data='myData', sort='file'} {myContent data='myData', sort='file NATURAL'}
|
|
App: regression/framework - Page: lenient/a_lone_end_still_splits
PHP
lenient/a_lone_end_still_splits.php
|
HTML
lenient/a_lone_end_still_splits.pad
|
Result
|
<?php
// The lenient walk under test: with the syntax check off, the marker splits where it // stands, as it always has.
$padCheckSyntax = FALSE;
?>
|
{data 'u'}[1,2]{/data}{u}{$u}@end@[q]{/u}
|
|
App: regression/framework - Page: lenient/a_nested_level_s_end_does_not_split_the_outer_level
PHP
lenient/a_nested_level_s_end_does_not_split_the_outer_level.php
|
HTML
lenient/a_nested_level_s_end_does_not_split_the_outer_level.pad
|
Result
|
<?php
// The lenient walk under test: with the syntax check off, a lone @end@ of a nested level // is that level's coda, and the outer level splits on its own marker.
$padCheckSyntax = FALSE;
?>
|
{data 'items'} [{"n":"a","subs":[{"s":1},{"s":2}]},{"n":"b","subs":[{"s":3}]}] {/data} {items} <ul> @start@ <li>{$n}{subs}{$s}@end@!{/subs}</li> @end@ </ul> {/items}
|
|
App: regression/framework - Page: options/a_level_the_handling_left_without_rows_renders_neither_prelude_nor_coda
PHP
options/a_level_the_handling_left_without_rows_renders_neither_prelude_nor_coda.php
|
HTML
options/a_level_the_handling_left_without_rows_renders_neither_prelude_nor_coda.pad
|
Result
|
<?php
$items = [ [ 'n' => 1 ], [ 'n' => 2 ] ]; $none = [];
?>
|
0[{none}H@start@R@end@F{/none}] 8[{items where='$n gt 5'}H@start@R@end@F{/items}] 12[{items first=0}H@start@R@end@F{/items}] 14[{items where='$n gt 5'}H@start@R@end@F@else@E{/items}] 15[{items where='$n gt 1'}H@start@{$n}@end@F{/items}]
|
|
App: regression/framework - Page: options/an_at_start_level_negative_and_first_left_without_rows_renders_nothing
PHP
|
HTML
options/an_at_start_level_negative_and_first_left_without_rows_renders_nothing.pad
|
Result
|
|
{data 'd'}[{"n":"a"},{"n":"b"},{"n":"c"}]{/data}<{d negative, first=3}pre @start@x@end@ post{/d}>
|
|
App: regression/framework - Page: options/todata_of_a_level_with_a_prelude_and_a_coda_stores_its_rows
PHP
options/todata_of_a_level_with_a_prelude_and_a_coda_stores_its_rows.php
|
HTML
options/todata_of_a_level_with_a_prelude_and_a_coda_stores_its_rows.pad
|
Result
|
<?php
$items = [ [ 'n' => 1 ], [ 'n' => 2 ], [ 'n' => 3 ] ];
?>
|
{items toData='c1'}{$n}{/items}{items toData='c2'}H@start@{$n}@end@F{/items}1[{c1}<{$n}>{/c1}] 2[{c2}<{$n}>{/c2}] 3[{c2}<{current@c2}>{/c2}]
|
|
App: regression/framework - Page: properties/count_in_a_prelude_or_a_coda_counts_the_rows
PHP
|
HTML
properties/count_in_a_prelude_or_a_coda_counts_the_rows.pad
|
Result
|
|
{data 'd'}[{"n":"a"},{"n":"b"},{"n":"c"}]{/data}{d}{count@d} rows: @start@{$n}@end@ - total {count@d}{/d}
|
|
|