Table flat in the tree view
source link: https://www.codesd.com/item/table-flat-in-the-tree-view.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Table flat in the tree view
I am currently stuck on the modification of an array "flat" to a array structure of a tree.
I have an array to the type:
$folders = array(
array('Name' => 'Archive', 'Value' => 'Archive', 'Attributes' => 32, 'Delimiters' => '/'),
array('Name' => 'Folder1', 'Value' => 'Archive/Folder1', 'Attributes' => 32, 'Delimiters' => '/'),
array('Name' => 'FolderA', 'Value' => 'Archive/Folder1/DossierA', 'Attributes' => 64, 'Delimiters' => '/'),
array('Name' => 'Folder2', 'Value' => 'Archive/Folder2', 'Attributes' => 32, 'Delimiters' => '/'),
array('Name' => 'FolderA', 'Value' => 'Archive/Folder2/FolderA', 'Attributes' => 32, 'Delimiters' => '/'),
array('Name' => 'FolderB', 'Value' => 'Archive/Folder2/FolderA/FolderB', 'Attributes' => 64, 'Delimiters' => '/'),
);
and I would get an array to the type:
$treefolders = array(
array('Name' => 'Archive', 'Value' => 'Archive', 'Attributes' => 32, 'Delimiters' => '/', 'subnode' =>
array('Name' => 'Folder1', 'Value' => 'Archive/Folder1', 'Attributes' => 32, 'Delimiters' => '/', 'subnode' =>
array('Name' => 'FolderA', 'Value' => 'Archive/Folder1/FolderA', 'Attributes' => 64, 'Delimiters' => '/')
),
array('Name' => 'Folder2', 'Value' => 'Archive/Folder2', 'Attributes' => 32, 'Delimiters' => '/', 'subnode' =>
array('Name' => 'FolderA', 'Value' => 'Archive/Folder2/FolderA', 'Attributes' => 32, 'Delimiters' => '/', 'subnode' =>
array('Name' => 'FolderB', 'Value' => 'Archive/Folder2/FolderA/FolderB', 'Attributes' => 64, 'Delimiters' => '/')
)
)
)
);
I do not know how to get to the last result.
Can you help me?
This is not possible, in PHP arrays cannot be used as array keys. You are able to use just the directory name as a key.
The best solution is to change the way you create your array or rethink your code and/or data structure. There is probably a much easier solution to your problem, maybe re-ask your question. See the XY problem.
Recommend
-
57
Inside Table Views the data is displayed using rows. These rows can be manipulated, in this tutorial we will add some rows using user input. This tutorial is made with Xcode 10 and built for iOS 12 Open Xcode and...
-
61
Multiple attributes of a Table View can be customised. In this tutorial we will change the background color of the Table View and the Table View Cells. We will also change the color of the separator and remove the separat...
-
9
Accessibility WTF: Voiceover on Mac announcing a list tree as a table? Wednesday, July 28th, 2021 at 9:14 pm I’m currently investigating a strange bug we got reported with t...
-
3
As the title, this is a spin-off of my last post in which I’ll talk about on Files list view instead of grid view. But...
-
6
Print Left View of a Binary TreeSkip to content
-
3
Bottom View of a Binary TreeSkip to content
-
5
透過 CSS 達到可折疊的 tree view 在 Hacker News 上看到「
-
3
Tree Page View Plugin 1.6.7 - Cross Site Scripting (XSS) ...
-
7
Print Left View of Binary Tree Skip to content...
-
3
Print Bottom View of Binary TreeJune 19, 2023 |60 ViewsPrint Bottom View of Binary TreeSDE Sheet, GFG SDE Sheet, binary-tree Save Share LikeDescription
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK