zend-framework2

Pass error message from controller to view in zf2

末鹿安然 提交于 2019-12-11 06:57:50
问题 I have simple login in zf2. I want to show error message error to user when username/password didn't match. In view/login.php: if (isset($error_msg)) { echo $error_msg; } In Controller I have: $msg = array('error_msg' => 'Invalid Username or Password'); return $this->redirect()->toRoute('login', $msg); Here error_msg cannot passed to view, what are wrong with this? Furthermore I also try $model = new ViewModel(array( 'error_msg' => 'Wrong username or password', )); $model->setTemplate('login

Ubuntu 16.04 - Apache 2.4.18 - Request-URI Too Long

流过昼夜 提交于 2019-12-11 06:46:48
问题 I am trying to save an image from Google Images search result but when I send the image's src in the query string parameter it gives the following error: Request-URI Too Long The requested URL's length exceeds the capacity limit for this server. Apache/2.4.18 (Ubuntu) Server at 127.0.1.1 Port 80 As I am getting this error on my local machine, it is possible for me to test any ideas you all got. Note: I did set the LimitRequestLine and LimitRequestFieldSize to 100000 in the /etc/apache2

What is the recomended way / best practice to Poedit translate strings without a source keyword?

时光怂恿深爱的人放手 提交于 2019-12-11 06:44:25
问题 I'm developing a Zend Framework 2 application an having a problem with translations. Actually in the view scripts a can use the view helper Translate. Since I defined "translate" as a source keyword in Poedit ( [Poedit menu] -> Catalogue -> Properties... -> Source keywords ) the strings are identified by the tool and added to the tranlation list. But there are also some strings at other places, where I cannot use the/a view helper, e.g. in form classes or in the navigation. How should this be

Zend Framework 2 Child Regex Routing

余生长醉 提交于 2019-12-11 06:32:41
问题 I have desperately been battling with ZF2, I am trying to create a route tree, so that: /manual - Goes to the Manual Controller, index action /manual/[something] - Goes to the Manual Controller, manufacturer action /manual/[something]/[else] - Goes to the Manual Controller, category action /manual/[something]/[else]/[foo] - Goes to the Manual Controller, model action I've used the official docs and several other websites but all I've been able to do is trigger: /manual - Goes to the Manual

Zend framework 2 : “ Connect Error: SQLSTATE[28000] [1045] Access denied”

╄→尐↘猪︶ㄣ 提交于 2019-12-11 06:24:22
问题 I have been working on the official tutorial for ZF2. At the end of the page, to see what gives the result, I get this long error: An error occurred An error occurred during execution; please try again later. Additional information: Zend\Db\Adapter\Exception\RuntimeException File: D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Driver\Pdo\Connection.php:243 Message: Connect Error: SQLSTATE[28000] [1045] Access denied for user

PHP stream_socket_client ignoring timeout

自古美人都是妖i 提交于 2019-12-11 05:38:09
问题 I'm using zend_mail from zend-framework2 in my project to send some amount of emails in a loop, but sometimes it takes more than usual to send an email. After doing some research, i found that the delay occurs on the stream_socket_client function. I tried to set this function's timeout to acceptable value, but it seems to ignore that setting. Also tried to use STREAM_CLIENT_PERSISTENT to limit the number of opened sockets but with no luck. Average stream_socket_client times are about 0.03

Vhost Zend Framework configuration MAMP - redirected to the index page of the server

孤街醉人 提交于 2019-12-11 05:07:14
问题 I have checked out the posts and made the appropriate changes to the configuration files to make zend framework 2 to work on my local environment. Everything goes fine but the redirection of the page on specifying the vhost name doesnot work appropriately. It displays me the home page of the MAMP server with the directory listing. Here is what I have done till now: httpd.conf <VirtualHost *:80> ServerName newportalcopper.localhost DocumentRoot /Applications/MAMP/htdocs/NewPortalCopper/public

form class not found zend 2.3

馋奶兔 提交于 2019-12-11 04:57:20
问题 I am trying to create a simple form using zendform here is the code of form class: <?php namespace admin\Form; use Zend\Form\Form; class Addstudent extends Form { public function __construct($name = null) { // we want to ignore the name passed parent::__construct('addstudent'); $this->add(array( 'name' => 'fio', 'type' => 'Text', 'options' => array( 'label' => 'Фио', ), )); $this->add(array( 'name' => 'gender', 'type' => 'Zend\Form\Element\Radio', 'options' => array( 'label' => 'Пол', 'value

Using ZF2 components without entire MVC process

a 夏天 提交于 2019-12-11 04:34:31
问题 How feasible is it to use the Zend Framework 2 components without using the MVC process? For example I love the forms / validation and ACL elements but am not sure if that is actually possible without the whole MVC system? As a framework ZF2 is very slow (although I think its a very good system) so would like to encourage its use without the whole package. Thanks. 回答1: Yes. Zend Form component has a separate repository and it can be used in any application as a component with help of composer

How to show a flashMessage raised by an exception without the error template

落花浮王杯 提交于 2019-12-11 04:33:26
问题 I have an exception raised in my service. This exception is handle by a Listener attached by : $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, array($this, 'handleException')); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'handleException')); Handle Exception designed into flashMessage by: public function handleException(MvcEvent $event) { $exception = $event->getParam('exception'); if ($exception) { $flashMessenger = new FlashMessenger(