Hello,
I have a folder where files are manually uploaded via FTP in the
format "YYYYMMDD-YYYYMMDD.pdf".
The task is to display these files in a table that will have these
fields: "link to file", "start date", "end date", "file size". I will
also need to paginate the results and sort by dates / size.
I've currently done this by using a controller in which I scan the
folder, parse the file names and return an array slice to the view, in
this format:
foreach (glob($path_to_files) as $file) {
$file_name = substr( $file, ( strrpos( $file, "/" ) +1 ) );
$file_list[$i++] = array (
'path'=> $file,
'name' => $file_name,
'size' => filesize($file),
'start' => substr($file_name,
6,2).'/'.substr($file_name,
4,2).'/'.substr($file_name, 0,4),
'end' => substr($file_name, 15,2).'/'.substr($file_name,
13,2).'/'.substr($file_name, 9,4)
);
}
I then display the data in the view and use some custom functionality
for paginating.
However, I'm thinking there has to be a better way to do this and use
Cake's functions for paginating, sorting, etc.
How would I feed the data in the format above to a model? I only need
"find all" functionality, no add, delete, edit.
Thanks in advance for any info,
Razvan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---