By default, if you pass only http://domain/?controller=yourController&action=yourAction is enough to ZF find the right controller and action.
If you want to access the default module or index controller or index actions, you don't need to pass their params, once ZF will redirect to its default values ('default' for module and 'index' for action and controller).
If you want to trigger a loginAction action on your AccountController, for example, just do this:
http://domain/?controller=account&action=login
If you have more than one module, you just need to pass the module variable with the name of your module, like:
http://domain/?module=yourModule&controller=yourController&action=yourAction
No special configuration is needed. When you have params to pass together, just add them on the URL query.
It should work fine without the mod_rewrite.
Regards,
/**
* Ramses Paiva
* Software Consultant
*
* SourceBits Technologies
* 63, 19th Main
* Rajajinagar 2nd Block
* Bangalore, KA, India
*
* Ph +91 80 4127 7434
* Mob +91 97 4237 6432
* Fax +91 80 2342 5494
* www.sourcebits.com
*/
If you want to access the default module or index controller or index actions, you don't need to pass their params, once ZF will redirect to its default values ('default' for module and 'index' for action and controller).
If you want to trigger a loginAction action on your AccountController, for example, just do this:
http://domain/?controller=account&action=login
If you have more than one module, you just need to pass the module variable with the name of your module, like:
http://domain/?module=yourModule&controller=yourController&action=yourAction
No special configuration is needed. When you have params to pass together, just add them on the URL query.
It should work fine without the mod_rewrite.
Regards,
/**
* Ramses Paiva
* Software Consultant
*
* SourceBits Technologies
* 63, 19th Main
* Rajajinagar 2nd Block
* Bangalore, KA, India
*
* Ph +91 80 4127 7434
* Mob +91 97 4237 6432
* Fax +91 80 2342 5494
* www.sourcebits.com
*/
On Fri, Sep 12, 2008 at 1:56 AM, Julien Pauli <doctorrock83@gmail.com> wrote:
You should read http://akrabat.com/2008/06/03/zend-framework-urls-without-mod_rewrite/
Julien.P2008/9/11 Emanuele Deserti <emanuele.deserti@netwing.it>I use a custom Request class with URL like this:
http://example.com/index.php?p=module/controller/action/key1/value1/key2/value2 etc...
This is the code (with stripped comments) of my Custom/Controller/Request/Pvariant.php:
<?php
/** Zend_Controller_Request_Exception */
require_once 'Zend/Controller/Request/Exception.php';
/** Zend_Controller_Request_Http */
require_once 'Zend/Controller/Request/Http.php';
/** Zend_Uri */
require_once 'Zend/Uri.php';
class Custom_Controller_Request_Pvariant extends Zend_Controller_Request_Http
{
protected $_pathKey = 'p';
public function setPathKey($key)
{
$this->_pathKey = (string) $key;
return $this;
}
public function getPathKey()
{
return $this->_pathKey;
}
public function setPathInfo($pathInfo = null)
{
parent::setPathInfo($pathInfo);
if (isset($_GET[$this->_pathKey])) {
$this->_pathInfo = (string) $this->_pathInfo . $_GET[$this->_pathKey];
}
return $this;
}
}
?>
and then, in bootstrap.php, before dispatch
$request = new Custom_Controller_Request_Pvariant();
$front->setRequest($request);
Maybe this method was not the best way (for sure was not the best way) but it's the only practicable that I have found without mod_rewrite and with the minimum effort...---
Is it possible to set up Zend MVC without using mod_rewrite, like this:
http://example.com/index.php?controller=myController&method=myMethod
Where do I start?
regards, Jan
--
View this message in context: http://www.nabble.com/Using-MVC-with-%24_GET-instead-mod_rewrite-tp19431142p19431142.html
Sent from the Zend MVC mailing list archive at Nabble.com.
Emanuele Deserti
Netwing S.r.l.
<emanuele.deserti@netwing.it>
Tel. 0532-1915183
http://www.netwing.it
没有评论:
发表评论