zend-framework-mvc

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

zend project on shared hosting?

∥☆過路亽.° 提交于 2019-12-12 02:40:11
问题 I created a zend project on localhost on ubuntu OS and it is working perfectly on my local system. Now I want to upload this project online. I purchased domain name and hosting. I got following directory structure to upload files. /www.example.com/web/content/ So www.example.com is pointing to /www.example.com/web/content/ folder. This directory structure is unchangeable. I put all public folder files to /www.example.com/web/content/ and application , library and tests folders into /www

ZF2: How can I set basePath to be the same for a whole application?

会有一股神秘感。 提交于 2019-12-11 10:23:00
问题 The manual's example shows how to set the basePath only for some specific viewModel : $this->getHelper('basePath')->setBasePath() But I want to set it somewhere in one place and then it is the same for any viewModel I create in any Controller. How can I do it? 回答1: You could set a global base path in config: 'view_manager' => array( 'base_path' => '/path/' ) 来源: https://stackoverflow.com/questions/13955426/zf2-how-can-i-set-basepath-to-be-the-same-for-a-whole-application

ZF2 - How to change the error/404 response page? Not just template but to set a new ViewModel

若如初见. 提交于 2019-12-09 18:27:54
问题 By default the page is set like this in the Application module.config array: 'template_map' => array( 'error/404' => __DIR__ . '/../view/error/404.phtml' I want to change the page. I want new ViewModel for it full of variables. It means that simply to change the template is not enough: 'error/404' => __DIR__ . '/../view/error/my_new_404_template.phtml' But I can't understand how to make it. I can't see the way the request comes to the 'error/404' . How to create new ViewModel for it? How to

How Can I Write Zend Framework URLs That Have Anchor Tags In The Body?

拜拜、爱过 提交于 2019-12-09 14:59:55
问题 Using the standard MVC set up in Zend Framework, I want to be able to display pages that have anchors throughout. Right now I'm just adding a meaningless parameter with the '#anchor' that I want inside the .phtml file. <?= $this->url(array( 'controller'=>'my.controller', 'action'=>'my.action', 'anchor'=>'#myanchor' )); This sets the URL to look like /my.controller/my.action/anchor/#myanchor Is there a better way to accomplish this? After navigation to the anchor link, the extra item parameter

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 Models shared between Modules

若如初见. 提交于 2019-12-07 06:42:31
问题 I've just started setting up a new ZF2 application for a new project, based off the ZF2 skeleton, and am looking at their tutorial on Models. tl;dr: how should I share a Model between multiple different modules, by putting it somewhere in a higher level (outside /module)? We have several modules setup like so: / /module/ModuleName /module/ModuleName/config /module/ModuleName/src /module/ModuleName/src/ModuleName I was just about to setup a folder /module/ModuleName/src/ModuleName/Model

ZF2 - How to change the error/404 response page? Not just template but to set a new ViewModel

ε祈祈猫儿з 提交于 2019-12-04 08:55:38
By default the page is set like this in the Application module.config array: 'template_map' => array( 'error/404' => __DIR__ . '/../view/error/404.phtml' I want to change the page. I want new ViewModel for it full of variables. It means that simply to change the template is not enough: 'error/404' => __DIR__ . '/../view/error/my_new_404_template.phtml' But I can't understand how to make it. I can't see the way the request comes to the 'error/404' . How to create new ViewModel for it? How to attach variables to it? How the route comes to 'error/404' to catch it to change? For example, I have

How Can I Write Zend Framework URLs That Have Anchor Tags In The Body?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 02:33:15
Using the standard MVC set up in Zend Framework, I want to be able to display pages that have anchors throughout. Right now I'm just adding a meaningless parameter with the '#anchor' that I want inside the .phtml file. <?= $this->url(array( 'controller'=>'my.controller', 'action'=>'my.action', 'anchor'=>'#myanchor' )); This sets the URL to look like /my.controller/my.action/anchor/#myanchor Is there a better way to accomplish this? After navigation to the anchor link, the extra item parameter gets set in the user's URL which is something I would rather not happen. one of possibilities is to

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 =