Thanks Adam. It is the solution of this problem. It really save me a lot of
time. [?]
Hope the others who has the same question can find this ticket.

On Sun, Jun 14, 2009 at 9:39 AM, Adam Royle <a...@sleekgeek.com.au> wrote:

>
> I found this problem too, when I was sending emails using a cron job, and
> needed to link back to the site. However there is an easy workaround.
>
> I am using the EmailTask from the Bakery, and added importing the router
> and
> routes definitions in here.
>
> <?php
> App::import('Core', 'Controller');
> App::import('Component', 'Email');
>
> App::import('Core', 'Router');
> config('routes');
>
> class EmailTask extends Shell {
> ...
>
>
> and then in my bootstrap.php I add this:
>
>
> /** CONFIG FOR CLI/SHELLS**/
>
> if (empty($_SERVER['HTTP_HOST'])) {
>  $_SERVER['HTTP_HOST'] = 'mydomain.com';
> }
>
> if (empty($_SERVER['HTTPS']) && $_SERVER['HTTP_HOST'] == 'mydomain.com') {
>  // set this to "off" if your website does not use SSL
>  $_SERVER['HTTPS'] = 'on';
> }
>
> if (!defined('FULL_BASE_URL')) {
>  define('FULL_BASE_URL',
> 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['HTTP_HOST']);
> }
>
>
>
> Hope that helps.
>
> Adam
>
> ----- Original Message -----
> From: "Walther" <waltherl...@gmail.com>
> To: "CakePHP" <cake-php@googlegroups.com>
> Sent: Sunday, June 14, 2009 3:09 AM
> Subject: Re: PHP Fatal error: Class 'Router' not found in
> cake\libs\view\helper.php on line 178
>
>
>
> Well, if you use <a href =''>xxx</a> then it's not using the router is
> it?
>
> Why would you want to be outputting links in a shell script anyway?
>
> On Jun 13, 10:57 am, joshua <josh...@gmail.com> wrote:
> > Why if I change to $html->link to <a href =''>xxx</a>, there will be no
> > this
> > error?
> > Did that mean we couldn't use html helper in shell script?
> >
> >
> >
> > On Sat, Jun 13, 2009 at 2:01 PM, AD7six <andydawso...@gmail.com> wrote:
> >
> > > On Jun 13, 5:19 am, joshua <josh...@gmail.com> wrote:
> > > > Hi Cakes,
> > > > Is there anybody come across this problem? When I try to run cron job
> > > > in
> > > > cake console, it print out this error.
> >
> > > > PHP Fatal error: Class 'Router' not found in
> cake\libs\view\helper.php
> > > on
> > > > line 178
> >
> > > > If I change to $html->link to <a href =''>xxx</a>, there will be no
> > > > this
> > > > error.
> >
> > > > My Shell Scripts like this:
> > > > [code]
> > > > class AbcShell extends Shell {
> > > > var $uses = array('modelA' );
> > > > var $helpers = array('Html','Javascript');
> >
> > > > function main(){
> > > > //....
> > > > }
> >
> > > > [/code]
> >
> > > > Is there anything I missed? Thanks in advance for your reply.
> >
> > > The router isn't needed for shell access, so most likely that's the
> > > reason it's not loaded.
> >
> > > AD
> >
> > --
> > Thanks
> > Joshua
>
>
>
>
> >
>


-- 
Thanks
Joshua

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

<<inline: 330.gif>>

Reply via email to