Thank you for you suggestions. From Martin's suggestion, I thought I would do this:
app/config/app.php: <?php $config['App']['base_url'] = 'http://www.example.com'; ?> app/config/bootstrap.php <?php Configure::load('app'); ?> app/vendors/shells/cron.php <?php // ... $base_url = Configure::read('App.base_url'); // ... ?> On Mar 23, 10:09 am, Martin Westin <martin.westin...@gmail.com> wrote: > You need two things: Servername and path to the application root. > Problem is those things are governed by Apache and Cake's shell cant > really figure out which vhost you "want" by itself. > > At least I never got it. What I did was to add a parameter to the > shell call where I provide the hostname I want Cake to use. My purpose > was to load domain-specific configurations but the setup is the same. > It is not automagic but it works. > > http://bakery.cakephp.org/articles/view/one-core-one-app-multiple-dom... > about 2/3 of the way down the page > > /Martin > > On Mar 23, 6:02 am, brian <bally.z...@gmail.com> wrote: > > > OK, I think I misunderstood you. In any case, you should have access > > to the constants WWW_ROOT, WEBROOT_DIR, etc. Have a look at > > ShellDispatcher class, for instance. But I have no experience with an > > app dir in a subdirectory of a site. > > > On Sun, Mar 22, 2009 at 9:22 PM, mattalexx <mattal...@gmail.com> wrote: > > > > Thank you for your response. > > > > On Mar 22, 7:04 pm, brian <bally.z...@gmail.com> wrote: > > >> On Sun, Mar 22, 2009 at 7:14 PM, mattalexx <mattal...@gmail.com> wrote: > > > >> > Hello, > > > >> > I am trying to find a function or constant that will reliably give me > > >> > the app's base URL, even when I'm in a shell and there's no HTTP being > > >> > spoken and therefore there's a limited $_SERVER var. > > > >> > Am I going to have to write my own Configure value? It seems like such > > >> > basic info, the URL of your app. > > > >> Use the -app switch > > > >>http://book.cakephp.org/view/108/the-cakephp-console > > > > Since I'm calling cake from the app dir, my app is already being > > > recognized. Does this give me access to the URL of my app from within > > > my Shell class? What's the call? > > > >> > Also, I would like it to know if there is the app is being requersted > > >> > from a subfolder. If my app is athttp://www.example.com, I would like > > >> > it return that. If my app is athttp://www.example.com/path/to/app, I > > >> > would like that value. > > > >> Why would you want that when using the console? If there's "no HTTP > > >> being spoken" it doesn't make a lot of sense to be using a URL. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---