PHP code example of vitkovskii / jte
1. Go to this page and download the library: Download vitkovskii/jte library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vitkovskii / jte example snippets
boot {
extend(param('parent'));
}
markup footer {
<div>
User count: [[ user_count_block = user_count_param ]]
</div>
}
markup footer {
<div>
User count: [[ =user_count_param ]]
</div>
}
markup footer {
<div>
User count: [[ user_count_block ]]
</div>
}
logic footer {
replace('user_count_block')->with(param('user_count'));
}
markup item {
Foo :) [[ =count ]]
}
markup footer {
<div>
[[ footer_content ]]
</div>
}
logic footer {
replace('footer_content')->with(iterator([1, 2, 3], function($item, $count) {
return block('item', ['count' => $count]);
}));
}
logic menu {
replace('menu_items')->with(iterator(param('menu'), function($item, $count) {
if ($count % 2 == 1) {
$class = 'bg-1';
} else {
$class = 'bg-2';
}
$item['class'] = $class;
return self($item);
}));
}
markup menu {
<ul class="head-menu">
[[ menu_items ]] {{
<li class="[[ =class ]]"><a href="[[ =url ]]">[[ =name ]]</a></li>
}}
</ul>
}