I am trying to send an email from CakePHP 2.1.2 through a console shell (eventually using a cron job). The view I am posting is a calendar with links to the application web page. The problem that I find is that the URLs do not include the correct path and from what I read, because there is no request object since I use the console. For example, if I create a view in my browser, I get links like this:
http:
but in the letter, using the same code, I get the following:
http:
which is close but no cigar.
I am trying to find a global one that I can install somewhere to just copy the application subdirectory, but have not yet found anything that works. Links are created using this code:
$newUrl = array();
$newUrl['controller'] = 'scheduledReports';
$newUrl['action'] = 'index';
$newUrl['url'] = array();
foreach ($data as $key => $value) {
$newUrl['show_date'] = "$year-$month-$key";
$newUrl['result'] = 'GOOD';
$data[$key]['num_complete'] = $this->Html->link(__('Complete: ') . $value['num_complete'], Router::reverse($newUrl, true), array('class' => 'green'));
I would think that this is a normal feature (sending the correct URLs to the console generated email), but I just can't figure it out.
thank
source
share