Re: App::import fail to load Component for imported controller

2009-01-20 Thread Miles J
Or you could make it a Component itself. class MailComponent extends Object { var $components = array('Email'); function simplemail($to, $subject, $body) { $mail_settings = Configure::read('Mail'); $this-Email-from= $mail_settings['from_name'] . ' ' .

Re: App::import fail to load Component for imported controller

2009-01-20 Thread mark_story
Controllers are not intended to be 'utility' I think you're going about things the wrong way. Components are intended to be 'utility classes' and components can have components. Realistically the only time you should be manually constructing a controller is for unit testing. Outside of that

App::import fail to load Component for imported controller

2009-01-19 Thread gerhardsletten
Writing an app where I was planing to move all email delivering in one controller. When I try to load this Utility controller in a function from another controller. App::import fail to load Email component in this controller Controller 1: code function send_message() { ...

Re: App::import fail to load Component for imported controller

2009-01-19 Thread _k10_
I think you are getting a little confused between controller and components. Your simplemail function could be placed inside the 'Email' component. And you could use the simplemail function in other controllers by importing the component (and not the controller) App::import('Component','Email')