Re: Working with files
How would I do that? Could somebody provide me with an example of using Cake's builtin File and Folder objects? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
On Jun 23, 2006, at 2:55 PM, Luke wrote: I am pretty new to the MVC model. I am rebuilding my File management system (that i just finished without cakePHP). My question is basically this: If I am working with files, won't my model be directories instead of a database? Would the file structure actually be the model? I am confused on how to approach this. Yep. Just put var $useTable = false; in your model definitions. From there, just start writing your own directory-manipulating functions right in the model. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
THANKS! That helps so much... that would have taken me probably 2 or 3 hours to figure out... :-D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
On Jun 23, 2006, at 3:13 PM, Luke wrote: THANKS! That helps so much... that would have taken me probably 2 or 3 hours to figure out... :-D For future reference, you might check out the manual. The chapter on models talks about $useTable specifically, and the Cake Sheet announced here earlier also has the property listed. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
I'm still having a hard time... can anybody post an example of a directory-manipulating function that is built into the model? I have tried many of the functions in the API meant to deal with functions, and I just can't seem to get them to work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
On Jun 23, 2006, at 3:35 PM, Luke wrote: I'm still having a hard time... can anybody post an example of a directory-manipulating function that is built into the model? I have tried many of the functions in the API meant to deal with functions, and I just can't seem to get them to work. You won't be using the API, because the Cake Model is meant for databases. You need to write your own functions that do the data manipulation you're after. Off the cuff: ?php class Something extends AppModel { var $useTable = false; function readDirectory($path) { $d = dir($path); $out['Handle'] = $d-handle; $out['Path'] = $d-path; while (false !== ($entry = $d-read())) { $out['Entries'][] = $entry; } $d-close(); return $out; } } ? This might be an example of a function you might use (taken from the example at http://us3.php.net/manual/en/class.dir.php) in a model. You would use this in your controller doing something like ?php class SomethingsController extends AppController { function index() { $this-set('home', $this-Something-readDirectory('/home/ billy')); } } ? At which point the array you're creating in Somthing::readDirectory() would be handed to the view. -- J --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
I meant I have tried many of the functions in the API meant to deal with files and folders... oops (not functions) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
What are all these methods for? http://api.cakephp.org/class_folder.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Working with files
Yes, you could certainly use Cake's builtin File and Folder objects for writing your own custom model. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---