App: manual - Page: fragments/lookup_1
PHP
fragments/lookup_1.php
|
HTML
fragments/lookup_1.pad
|
Result
|
<?php
$customers = [ [ 'id' => 1, 'name' => 'Ann', 'country' => 'NL' ], [ 'id' => 2, 'name' => 'Bob', 'country' => 'BE' ] ];
$orders = [ [ 'number' => 101, 'customer_id' => 2 ], [ 'number' => 102, 'customer_id' => 1 ], [ 'number' => 103, 'customer_id' => 7 ] ];
?>
|
{orders} <p>Order {$number}: {echo $customer_id | lookup('customers', 'id', 'name') | ?? 'unknown customer'}</p> {/orders}
|
|
App: manual - Page: fragments/lookup_2
PHP
fragments/lookup_2.php
|
HTML
fragments/lookup_2.pad
|
Result
|
<?php
$customers = [ [ 'id' => 1, 'name' => 'Ann', 'country' => 'NL' ], [ 'id' => 2, 'name' => 'Bob', 'country' => 'BE' ] ];
$orders = [ [ 'number' => 101, 'customer_id' => 2 ], [ 'number' => 102, 'customer_id' => 1 ], [ 'number' => 103, 'customer_id' => 7 ] ];
?>
|
{data 'countries'} [ {"code": "NL", "label": "Netherlands"}, {"code": "BE", "label": "Belgium"} ] {/data}
{customers} <p>{$name} lives in {$country | lookup('countries', 'code', 'label')}</p> {/customers}
|
|
App: regression/errors - Page: syntax/a_lookup_names_a_data_set_that_is_there
PHP
|
HTML
syntax/a_lookup_names_a_data_set_that_is_there.pad
|
Result
|
|
{echo 1 | lookup('nothing', 'id', 'name')}
|
|
App: regression/errors - Page: syntax/a_lookup_needs_its_data_set
PHP
|
HTML
syntax/a_lookup_needs_its_data_set.pad
|
Result
|
|
{echo 1 | lookup}
|
|
App: regression/framework - Page: functions/lookup_finds_a_field_of_the_row_in_another_set_whose_key_equals_the_value
PHP
functions/lookup_finds_a_field_of_the_row_in_another_set_whose_key_equals_the_value.php
|
HTML
functions/lookup_finds_a_field_of_the_row_in_another_set_whose_key_equals_the_value.pad
|
Result
|
<?php
$customers = [ [ "id" => 1, "name" => "ann", "country" => "nl" ], [ "id" => 2, "name" => "bob", "country" => "be" ] ];
$orders = [ [ "number" => 101, "customer_id" => 2 ], [ "number" => 102, "customer_id" => 1 ], [ "number" => 103, "customer_id" => 9 ] ];
?>
|
{orders}{$number}:{echo $customer_id | lookup('customers', 'id', 'name')}/{$customer_id | lookup('customers')} {/orders}
|
|
App: regression/framework - Page: functions/lookup_reads_a_data_block_and_a_data_file_and_a_miss_is_empty
PHP
functions/lookup_reads_a_data_block_and_a_data_file_and_a_miss_is_empty.php
|
HTML
functions/lookup_reads_a_data_block_and_a_data_file_and_a_miss_is_empty.pad
|
Result
|
<?php
$customers = [ [ "id" => 1, "name" => "ann", "country" => "nl" ], [ "id" => 2, "name" => "bob", "country" => "be" ] ];
$orders = [ [ "number" => 101, "customer_id" => 2 ], [ "number" => 102, "customer_id" => 1 ], [ "number" => 103, "customer_id" => 9 ] ];
?>
|
{data 'countries'}[{"code":"nl","label":"Netherlands"},{"code":"be","label":"Belgium"}]{/data}{orders}{echo $customer_id | lookup('customers', 'id', 'country') | lookup('countries', 'code', 'label') | ?? 'unknown'} {/orders}|{echo 'jim' | lookup('staff', 'name', 'salary')}
|
|
App: regression/framework - Page: functions/lookup_sees_a_set_that_was_defined_again
PHP
|
HTML
functions/lookup_sees_a_set_that_was_defined_again.pad
|
Result
|
|
{data 'c'}[{"id":1,"name":"old"}]{/data}{echo 1 | lookup('c', 'id', 'name')}{data 'c'}[{"id":1,"name":"new"}]{/data}{echo 1 | lookup('c', 'id', 'name')}
|
|
App: regression/framework - Page: passes/a_sandbox_lets_lookup_chart_tree_and_pager_miss_the_names_it_hides
PHP
passes/a_sandbox_lets_lookup_chart_tree_and_pager_miss_the_names_it_hides.php
|
HTML
passes/a_sandbox_lets_lookup_chart_tree_and_pager_miss_the_names_it_hides.pad
|
Result
|
<?php $sbxRows = [ [ 'id' => 1, 'name' => 'Ann' ] ]; ?>
|
{data 'sbxSet'}[{"id":1,"name":"Ann"}]{/data}{sandbox}[{echo 1 | lookup('sbxSet', 'id', 'name')}][{echo 1 | lookup('sbxRows', 'id', 'name')}][{tree 'sbxRows'}x{/tree}][{tree 'sbxSet'}x{/tree}][{chart 'bar', data='sbxRows'}][{sparkline data='sbxSet'}][{sbxRows page=1, rows=1}r{/sbxRows}{pager 'sbxRows'}]{/sandbox}
|
|
|