I build and test all my code as a normal controller.
I create a normal view for my normal action which will show me the
contents of the /view/elements/email/html/ view.
The contents of this view are:
<?php
echo $this->renderElement('email/html/projectemail');
?>
This allows me to view the email from the browser by calling my
controller/action (Profiles/notify)
Then from my shell, I can simply setup enough of the environment to
call my controllers action the same way I would have from the browser.
App::import('Core', array('Controller','Component',
'View','Model','Router'));
App::import('Component', 'Email');
App::import('Controller', array('Profiles','Projects'));
App::import('Model','Profile');
//And then I create a Controller object since I already have the
action built and working from a controller.
function initialize() {
$this->ProfileController =& new ProfilesController();
$this->ProfileController->uses = array('Profile','User');
$this->ProfileController->Profile =& new Profile();
$this->ProfileController->Project =& new Project();
$this->ProfileController->Email =& new EmailComponent(null);
$this->ProfileController->Email->startup($this->ProfileController);
$this->_loadModels();
}
//And then call the controllers action.
function send(){
if (isset($this->args[0])){
$this->interactive = $this->args[1];
}
$this->ProfileController->notify();
}
On Oct 29, 2:07 am, JuergenRiemer <[EMAIL PROTECTED]> wrote:
> Does no one ever encountered this problem? How did you overcome it
> respectively; other than attaching a file which works.
>
> On 28 Okt., 08:39, JuergenRiemer <[EMAIL PROTECTED]> wrote:
>
> > still looking for a solution:
> > How can I use the Email Component from within ashellscript _and_
> > pass on data to the template .ctp file?
> > thanks
> > Juergen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---