1. Go to this page and download the library: Download dryas/f3_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/ */
dryas / f3_tree example snippets
// If you don't use composers autoloader feature, you need to include the F3_Tree class
QL
// class as the parameter:
$f3t = new F3_Tree($f3->get('DB'));
// populate the table
// add 'Food' as a topmost node
$food = $f3t->add(0, 'Food');
// 'Fruit' and 'Meat' are direct descendants of 'Food'
$fruit = $f3t->add($food, 'Fruit');
$meat = $f3t->add($food, 'Meat');
// 'Red' and 'Yellow' are direct descendants of 'Fruit'
$red = $f3t->add($fruit, 'Red');
$yellow = $f3t->add($fruit, 'Yellow');
// add a fruit of each color
$cherry = $f3t->add($red, 'Cherry');
$banana = $f3t->add($yellow, 'Banana');
// add two kinds of meat
$f3t->add($meat, 'Beef');
$f3t->add($meat, 'Pork');
// move 'Banana' to 'Meat'
$f3t->move($banana, $meat);
// get a flat array of descendants of 'Meat'
$f3t->get_children($meat);
// get a multidimensional array (a tree) of all the data in the database
$f3t->get_tree();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.