zend-framework-routing

url passing parameters in zend framework

痴心易碎 提交于 2019-12-25 03:07:32
问题 In zendframework ,When i am moving to new page with parameters using code as $this->_helper->redirector('my-action','my-controller',null,$params-array); , it showing parameters in every url in application. Can anybody help me in this? 回答1: You can use $params = array('user' => $user, 'mail' => $mail); $this->_helper->redirector($action, $controller, $module, $params); Thanks 回答2: you can try this $this->_redirect('Controllername/action?para1=value&para2=value'); Try this it'work I hope it

Zend Framework 2 Segment Route matching 'test' but not 'test/'

老子叫甜甜 提交于 2019-12-24 19:27:08
问题 I have two modules Admin and Application. In the module application I have the following route in my module.config.php: 'admin' => array( 'type' => 'Segment', 'options' => array( 'route' => '/admin[/:controller[/:action]]', 'constraints' => array( 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', ), 'defaults' => array ( '__NAMESPACE__' => 'Admin\Controller', 'module' => 'Admin', 'controller' => 'Index', 'action' => 'index', ), ), 'may_terminate' => true, 'child

Zend Framework 2 routing error: resolves to invalid controller class or alias

点点圈 提交于 2019-12-24 17:09:33
问题 I'm trying to learn Zend Framework 2 and I have their skeleton application up and running. In order to access it I visit http://localhost:8080/. When visiting that link it displays their generic Zend page. What I want to be able to do is visit http://localhost:8080/application/test and have it bring me to a different page with a different layout. Here is the module.config.php <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework

ZF2: How to attach listener on the event in the Module class?

风格不统一 提交于 2019-12-13 06:45:34
问题 I want to set a basePath to be the same for every component of my Mvc for a given request. I mean when I call these methods I want to get the same result, lets say '/spam/ham/' : echo $this->headLink()->prependStylesheet($this->basePath() . '/styles.css') // $this->basePath() has to be '/spam/ham/' $this->getServiceLocator() ->get('viewhelpermanager') ->get('headLink') ->rependStylesheet($this->getRequest()->getBasePath() . '/styles.css') // $this->setRequest()->getBasePath() has to be /spam

Automatic convention-based routing within a module in Zend Framework 2--possible?

折月煮酒 提交于 2019-12-13 04:23:25
问题 I'm trying to understand all the configuration necessary to get my routing working in Zend Framework 2, and I can't help but wonder if I am making this more complicated than necessary. I am working on a simple app that will follow a very simple convention: /:module/:controller/:action I've already created and wired up my module, "svc" (short for "service)". I then created a second controller, the "ClientsController", and I can't get the routing to pass through my requests to, e.g., /svc

How to add a rule to the Zend URL mapping and compose multiple MVC paths?

梦想的初衷 提交于 2019-12-11 09:45:25
问题 This is because I want to develop a web platform with more than one application in the same project. In any MVC web application we should have this default URL schema: domain / controller / action / parameters 1: In Zend, what can I do (in which files) to change this schema to add the application name before the controller name? Expected Result: domain / application / controller / action / parameters 2: How can I implement the consequences of this new URL block in terms that I will separate

ZF2: How to pass parameters to forward plugin which I can then get in the method I forward them to?

▼魔方 西西 提交于 2019-12-09 12:14:38
问题 I have an Action method in Foo Controller which requires parameters: public function fooAction($one, $two) { $a = one; $b = $two; } And I need to forward to that method from the other method of some Boo Controller. And one of those parameters has to be by reference parameter. The only example that the manual has is this: $result = $this->forward()->dispatch('Boo\Controller\Boo', array('action' => 'boo')); No any additional parameters. But they write: $params is an optional array of parameters

ZF2: How to pass parameters to forward plugin which I can then get in the method I forward them to?

你。 提交于 2019-12-03 13:22:06
I have an Action method in Foo Controller which requires parameters: public function fooAction($one, $two) { $a = one; $b = $two; } And I need to forward to that method from the other method of some Boo Controller. And one of those parameters has to be by reference parameter. The only example that the manual has is this: $result = $this->forward()->dispatch('Boo\Controller\Boo', array('action' => 'boo')); No any additional parameters. But they write: $params is an optional array of parameters with which to see a RouteMatch object for purposes of this specific request. So, I tried: $result =

How can you add query parameters in the ZF2 / ZF3 url view helper

笑着哭i 提交于 2019-11-27 08:37:42
I'm attempting to create a url with a query string using a route, like so: $this->url('users') -> /users $this->url('users', ['sort' => 'desc']) -> /users?sort=desc However this doesn't seem to work (the second helper actually outputs /users ). According to this unofficial, out-of-date documentation there was once a way to do this by appending /query to the route name, however this gives a route-not-found exception. Can this be done using the current url helper? You can create a child route for your users route like this: 'users' => array( 'type' => 'Literal', 'options' => array( 'route' => '

URIs with german special characters don't work (error 404) in Zend Framework 2

跟風遠走 提交于 2019-11-27 07:22:18
问题 I want to get a list of cities, where each city name is linked and refers a page for this city: The links (created in the view script) look like this: http://project.loc/catalog/Berlin (in the HTML source code url-encoded: Berlin) http://project.loc/catalog/Erlangen (in the HTML source code url-encoded: Erlangen) http://project.loc/catalog/Nürnberg (in the HTML source code url-encoded: N%C3%BCrnberg) "Berlin", "Erlangen" etc. work, but if the city name contains a german special character ( ä