Hi,
I found a way to make it work but I am not sure if it is the right way.
/usr/bin/php foo.php
foo.php
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array(
'default' => __FILE__.'/default/controllers'
);
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setNeverRender(true);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$req = new Zend_Controller_Request_Http('
http://localhost/controller/action/');
$req->setParam('xxx', 'yyy');
$front->setRequest($req);
$front->dispatch();
I have a default/controllers/IndexController.php with the action.
I've tried to use the Zend_Controller_Request_Simple but did not work.
Comments?
On Tue, Aug 12, 2008 at 4:05 PM, mbneto <[EMAIL PROTECTED]> wrote:
> Hi Mathew,
>
> The documentation on Zend_Console_Getopt gave me no clue of how to use it
> in order to dispatch a request to an existing controller/action.
>
> Do you have any other info about this? Perhaps a code sample?
>
> - Thanks
>
>
> On Sat, Jul 26, 2008 at 9:22 AM, Matthew Weier O'Phinney <[EMAIL PROTECTED]
> > wrote:
>
>> -- mbneto <[EMAIL PROTECTED]> wrote
>> (on Saturday, 26 July 2008, 07:58 AM -0400):
>> > Is there any way to use the MVC from the PHP CLI?
>>
>> Yes -- it's pretty trivial to create request objects that pull options
>> via Zend_Console_Getopt (though we do not have an official one), and we
>> already ship a Cli version of the response object.
>>
>> ZF is in no way tied to just web applications as the person below has
>> claimed.
>>
>> > On Thu, Jan 17, 2008 at 11:06 PM, ctx2002 <[EMAIL PROTECTED]> wrote:
>> >
>> >
>> > you cannot do it , sorry.
>> > ZF is a web based application, need apache(or any web server) to
>> make it
>> > work.
>> >
>> > regards
>>
>> --
>> Matthew Weier O'Phinney
>> Software Architect | [EMAIL PROTECTED]
>> Zend Framework | http://framework.zend.com/
>>
>
>