Re: Can i get $webroot for a vendor library?
Really useful dima. Thanks. What i really want to do with Image is to represent an image as an object. Like this: exists()) { echo ' echo $thumb->toHtml(array('border' => 0)); echo ''; } ?> Now as a component is no useful because i can only have one instance of the object (i think). I saw the File class perfect for this purpose. So i extend it. This class is for cake only. No plans for using elsewhere. If work ill cleanit up i little bit and uploaded. Maybe somebody likes. Thanks for your help ;) Also pardon my english --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
Okay, This may be a little late, but if you are creating a vendor lib, you should not be fetching Cake data. Instead do something like: $Image->setImageRoot("/mysite/html/images/productos/thumbs/"); ... $Image->fileURL("nameOfFile.jpg"); # /mysite/html/images/productos/thumbs/nameOfFile.jpg This way you separate your lib from Cake for maximum reuse (despite the fact that you're extending File). Just a thought... --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
Sorry. I Just realize that FIle extends Object. So ill guess ill turn Image class into a component. ;) Thank you All!! --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
Great Tip RosSoft, ginstrom. Thanks! One more thing. The Image library extends File but the components extends Object. I know i could use the File class by agregation but i wanted to inherit the File methods in Image. Any tips about that? --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
A good way to have a component in a view: class ImageComponent extends Object { function startup(&$controller) { $this->controller =& $controller; $this->controller->set('image', $this); } function hello() { return "hi!"; } } it will be available in views: echo $image->hello(); --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
Logan wrote: > Because i need to used in the view and/or the controller. Probably i'm > missing something. > I'm kind of new to MVC. If I'm not mistaken, you can access components from the view (just not helpers from the controller). If you are serving an image generated on the fly, you could also set a null layout and simply have the component output the headers, create the image, and read() it or whatever, then call exit. --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
Because i need to used in the view and/or the controller. Probably i'm missing something. I'm kind of new to MVC. --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
Any particular reason not to use Components? --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
not the full one. From WWW_ROOT i get '../html', I need '/mysite/html/', the full webroot ;) --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
is it not available from the defines? WWW_ROOT or WEBROOT_DIROn 6/24/06, Logan <[EMAIL PROTECTED] > wrote:I found out a way by importing the $Dispatcher.function _construct($src = "" { global $Dispatcher;$this->webroot = $Dispatcher->webroot;}Any other clean way for our public? ;) --~--~-~--~~~---~--~~ 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: Can i get $webroot for a vendor library?
I found out a way by importing the $Dispatcher. function _construct($src = null) { global $Dispatcher; $this->webroot = $Dispatcher->webroot; } Any other clean way for our public? ;) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can i get $webroot for a vendor library?
Im developing a library called Image who extends File. Its allow renaming, moving, finding, resizing, deleting images and (specially), printing img tags into the document. It does some job with the image that has to be in the controller but also print the image as html. So you see, can't be a component or a helper. So i made it a vendor library. But when it prints the img tag, can find a way to print the src like $html->image() does. (I mean correctly) Example: Right: Wrong: The webroot its '/mysite/html/'. Its there a way to get $webroot in a vendor library so i can create the code like $html->image()? I check the cake folder but can't find any var containing $webroot that i can access in a "clean" way. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---