Thursday, November 12, 2009

and your routes shell be free

CakePHP routing and reverse routing does not work properly in shells. That is because your defined routes in routes.php are actually not loaded at all. Maybe 1.3 will fix this but until then read on. 
To have proper routes in the email messages you are sending from shells you need to do this in your shell at the top:


App::import('Core', 'Router');
include CONFIGS . 'routes.php';
define('FULL_BASE_URL', Configure::read('App.HttpHost'));


where App.HttpHost is something you set manually in your bootstrap because the shell doesn't have a clue about your site and the web server.
Bake on!

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home