Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $rows = $db->select('*')->from('tabulka')->fetchAssoc('id');
- foreach ($rows as $id => $row) {
- if (!$row['parent']) {
- continue;
- }
- $rows[$row['parent']]['children'][] = $row;
- unset($rows[$id]);
- }
- // šanblona
- <ul n:block="#tree">
- <li n:foreach="$rows as $row">{$row['nazev']}
- {ifset $row['children']}
- {include #tree, $rows => $row['children']}
- {/ifset}
- </li>
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment