zend-framework2

How to change layout in controller in ZendFramework2?

廉价感情. 提交于 2019-12-25 03:03:21
问题 I found this topic and answer: Change layout in the controller of Zend Framework 2.0 :: Answer I am trying to do this: public function loginAction() { if ($this->zfcUserAuthentication()->hasIdentity()) { return $this->redirect()->toRoute('zfcadmin'); } $this->layout('layout/login'); return new ViewModel(); } But it doesn't work. Sure I have file MODULE_DIR/view/layout/login.phtml . I tried to var_dump($this->layout()); before setting layout and after it and it shows, that layout is changed

Zend Framework 2 - Set prefix for form elements

给你一囗甜甜゛ 提交于 2019-12-25 02:52:22
问题 I'm looking for a way to add prefixes for every element of a certain form. If found this post telling me that there is a elementsBelongTo option which I can use to achieve what I want. Unfortunately I can't find any documentation explaining the usage. Does anyone know how I can use this option? And if it's still in ZF2? And furthermore: I there a way to combine it with the nice AnnotationForms ? 回答1: Don't know if it will help, but instead of prefix you can wrap elements in form or fieldset

Zend Framework 2 - Set prefix for form elements

試著忘記壹切 提交于 2019-12-25 02:52:06
问题 I'm looking for a way to add prefixes for every element of a certain form. If found this post telling me that there is a elementsBelongTo option which I can use to achieve what I want. Unfortunately I can't find any documentation explaining the usage. Does anyone know how I can use this option? And if it's still in ZF2? And furthermore: I there a way to combine it with the nice AnnotationForms ? 回答1: Don't know if it will help, but instead of prefix you can wrap elements in form or fieldset

syntax error, unexpected ''sidebar_bann' (T_ENCAPSED_AND_WHITESPACE), expecting ']' when working with MongoDB ODM and ZF2

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 02:48:35
问题 I'm working with ZF2 with MongoDB and Doctrine 2 ODM, I got the above mentioned error on New Relic (New relic is continuously checking the live environment and logging the errors). I got the following error: syntax error, unexpected ''sidebar_bann' (T_ENCAPSED_AND_WHITESPACE), expecting ']' TracedError reported from New Relic Timestamp: 02/26/14 10:49:15 Exception Class: E_PARSE Error Action: /index.php Uri: /blog Error message E_PARSE: syntax error, unexpected ''sidebar_bann' (T_ENCAPSED_AND

zf2 website with a single entry-point, no routes/paths in URL

自古美人都是妖i 提交于 2019-12-25 02:38:10
问题 Is it be possible to make a website that doesn't reveal any relative URL's at all? Say for example, I have a domain name "somedomain.xyz" and I want to route everything through the default route, and I want not to reveal any paths or route structures to the end user. The end user shall only see the domain name in the browser's address bar, like: http://somedomain.xyz or https://somedomain.xyz. Any path like http://somedomain.xyz/index.php or http://somedomain.xyz/index or http://somedomain

Zend Framework - Same browser open multiple tabs but wait for first request to finished

别等时光非礼了梦想. 提交于 2019-12-25 02:29:49
问题 I have issue with same browser client try to open multiple tabs with it. but my server is wait for first request to finished. for example Open first browser tab that take more time like 30sec. Now, next tab open with the help of CTR + Mouse click open new tab in bowser that is just static page 1 sec wait; but stil i have to wait for first request to finished. Note : I have website in not in live but i am using following technology PHP 5.4, Mysql, Zend Framework 2.1, Xampp 1.8 Please guide in

always returns status code 200

偶尔善良 提交于 2019-12-25 02:29:35
问题 I am returning response from onBootStrap() this way.. $app = $e->getApplication(); $em->attach(MvcEvent::EVENT_ROUTE, function($e) use ($app) { $response = $e->getResponse(); $response->setStatusCode(403); $jsonValue = json_encode(array( 'error' => 12345, 'message' => 'You are not authorized for this request', )); $response->setContent($jsonValue); return $response; }, PHP_INT_MAX); But the problem is I am getting status code 200 even if I am passing different ones. I am running this API from

ZF2 Union + Pagination

与世无争的帅哥 提交于 2019-12-25 02:10:33
问题 I'm using ZF2 and SQL Server 2012. I'm trying to write a union query with pagination. It seems like support for unions in ZF2 is not fully there. There is no union() method, but I see that there is a combine() method. It creates the query with the union, but it puts the ORDER BY on the first query instead of on the entire unioned query. So when the ZF2 paginator tries to add the limit/offset parts, SQL Server chokes because it has to have an ORDER BY on the whole query. Here is my code:

zf2 URL Helper customization to add achnor for angularjs router

放肆的年华 提交于 2019-12-25 02:01:05
问题 I have a following Link in zf2 <a href="<?php echo $this->url('application/default',array('controller'=> 'enquiries', 'action'=>'index')) ?>"><?php echo $this->translate('Enquiries') ?></a> and this router in zf2 'application' => array( 'type' => 'Literal', 'options' => array( 'route' => '/application', 'defaults' => array( '__NAMESPACE__' => 'Application\Controller', 'controller' => 'Index', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array(

zend framework 2 get locale from view PhpRenderer

浪子不回头ぞ 提交于 2019-12-25 01:01:13
问题 How I can obtain traslator locale in my view? I want to do it starting from the variable $this (the PhpRenderer of the view). i.e. I don't want use onBootstrap nor ActionController because I don't care to have a view variables. Thank you! 回答1: You should try: <?php echo \Locale::getDefault(); ?> Many of the I18n classes make reference to PHP's Locale class (http://www.php.net/locale) - so in my opinion that would be a good starting point. 回答2: <?php echo $this->plugin('translate')-