Home / Zend Framework

Zend Framework

Zend Framework

Create Different session for admin and frontend using zfcuser in Zend framework 2

If you want use twice ZendAuthenticationAuthenticationService, look in ZendAuthenticationStorageSession, you’ll see in __construct, there’s an namespace parameter, change it for “Zend_Auth_Frontend” (in front) and “Zend_Auth_Backend” for the back. How you can perform above change please follow below steps: For Frontend Changes Please change in two file Step 1: Go to …

Read More »

How to remove “public” from url using routeing in zend framework 2

Create index.php on ZF2 root directory and add the following content: <?php define('REMOVE_PUBLIC_FROM_URL', true); include 'public/index.php'; Create .htaccess on ZF2 root directory and add the following content: SetEnv APPLICATION_ENV development RewriteEngine On RewriteRule .* index.php Finally, add this conditional statement in the top of your layout.phtml file: <?php if (defined('REMOVE_PUBLIC_FROM_URL')) …

Read More »

Validate records in zf2

Inside the controller : public function addAction() { $form = new TestForm(); $form->get('submit')->setAttribute('value', 'Add'); $request = $this->getRequest(); if ($request->isPost()) { $test = new Test(); $form->setInputFilter($test->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $test->exchangeArray($form->getData()); if($this->getTestTable()->validateRecord($test, 'field1', 'test')){ $this->getTestTable()->saveTest($test); $this->flashMessenger()->addMessage('Record added in db'); // Redirect to list of tests return $this->redirect()->toRoute('test'); } else{ $this->flashMessenger()->addMessage('Record Exist …

Read More »
Welcome to VShakya

For this week my all price is very low !

Don't miss to get my services

Thanks

 

Contact us