I was a little bit confused when I made my first post. This time I'll be more specific.
I'm trying to make a "filetree-like" table from an object (From a php-transmission project). In my table I would have the filename, the size and the status (done or not). In the "Name" we can see some kind of "full path to file" string.
Thomas helped me out of making an array of names, but I forgot telling him that I was trying to grab it from an object..
Here is a sample of my code:
<?php
$transmission = new Transmission();
$transfer= $transmission->get('26ec249e2669388ff359923702ac0f5c7687d1be');
$files = $transfer->getFiles();
foreach($files AS $file)
{
var_dump($file->getName()); // RootFolder/Folder1/File1.jpg
var_dump($file->getSize()); // 10383488
var_dump($file->isDone()); // True or False
print_r($file);
}
Output:
string(59) "RootFolder/Folder1/File1.jpg"
int(13324)
bool(true)
TransmissionModelFile Object
(
[name:protected] => RootFolder/Folder1/File1.jpg
[size:protected] => 13324
[completed:protected] => 13324
[client:protected] =>
)
$files will output:
Array
(
[0] => TransmissionModelFile Object
(
[name:protected] => RootFolder/Folder1/File1.jpg
[size:protected] => 13324
[completed:protected] => 13324
[client:protected] =>
)
[1] => TransmissionModelFile Object
(
[name:protected] => RootFolder/Folder1/File2.mp3
[size:protected] => 10383488
[completed:protected] => 10383488
[client:protected] =>
)
[2] ...
)
I saw a nice work from www.abeautifulsite.net, but it's based on is_dir()
command.
What I want to do is a html table with collapsible parts (on folders) and files info (name, size and status) on file rows.
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…