PHP code example of yongtiger / yii2-bootstrap-tree
1. Go to this page and download the library: Download yongtiger/yii2-bootstrap-tree 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/ */
echo \yongtiger\bootstraptree\widgets\BootstrapTree::widget([
'options'=>[
//https://github.com/jonmiles/bootstrap-treeview#options
'data' => $items, ///(needed!)
'enableLinks' => true, ///(optional)
'showTags' => true, ///(optional)
'levels' => 3, ///(optional)
'multiSelect' => true, ///(optional, but when `selectParents` is true, you must also set this to true!)
],
'htmlOptions' => [ ///(optional)
'id' => 'treeview-tabs',
],
'events'=>[ ///(optional)
//https://github.com/jonmiles/bootstrap-treeview#events
'onNodeSelected'=>'function(event, data) {
// Your logic goes here
alert(data.text);
}'
],
///(needed for using jonmiles bootstrap-treeview 2.0.0, must specify it as `<a href="{href}">{text}</a>`)
'textTemplate' => '<a href="{href}">{text}</a>',
///(optional) Note: when it is true, you must also set `multiSelect` of the treeview widget options to true!
'selectParents' => true,
]);
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.