PHP Classes

File: tests/selectTree.php

Recommend this page to a friend!
  Classes of Ali YILMAZ  >  Mind Framework  >  tests/selectTree.php  >  Download  
File: tests/selectTree.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Mind Framework
Framework that implements several design patterns
Author: By
Last change:
Date: 3 months ago
Size: 1,384 bytes
 

Contents

Class file image Download
<?php
require_once ('../src/Mind.php');

$Mind = new Mind([
   
'db'=>[
       
'drive' => 'mysql', // mysql, sqlite
       
'host' => 'localhost',
       
'dbname' => 'mydb', // mydb, app/migration/mydb.sqlite
       
'username' => 'root',
       
'password' => '',
       
'charset' => 'utf8mb4'
   
]
]);

$data = [
    [
       
'id' => 33,
       
'name' => 'Series',
       
'parent' => null,
       
'children'=>[
           
34=>[
               
'id' => 34,
               
'name' => 'First dragon',
               
'parent' => 33,
               
'children'=>[
                   
36=>array(
                       
'id' => 36,
                       
'name' => 'Season 1',
                       
'parent' => 34,
                       
'children'=>[
                           
38=>array(
                               
'id' => 38,
                               
'name' => '1-10',
                               
'parent' => 36,
                               
'children'=>[]
                            )
                        ]
                    )
                ]
            ]
        ]
    ],
    [
       
'id' => 39,
       
'name' => 'Manga',
       
'parent' => null,
       
'children'=>[]
    ]
];

?>

<select>
<?php echo $Mind->selectTree($data); ?>
</select>

<br>

<select>
<?php echo $Mind->selectTree($data, 36); ?>
</select>

For more information send a message to info at phpclasses dot org.