'zf2' Tag

  • Zf2 Navigation Custom Active Page

    October 31, 2015

    Zf2 Naviagation Custom Active Page Call in layout/view $nav = $this->navigation('Navigation'); $pages = $nav->getContainer()->getPages(); foreach ($pages as $page) { if ($page->getId() == 'admin') { $page->setActive(true); } }

  • Zf2 Doctrine 2 Log Every Entity Change

    September 18, 2015

    In this article I will show a simple way to log every change to doctrine 2 entity. This one will not be copy / paste. Just check out the code and help yourself. 1. Create event service /** * @developer Ivan Gospodinow */ namespace Application\Service; use Application\Entity\DbLogEntity; use Application\Entity\AbstractEntity; use Doctrine\Common\Persistence\Event\LifecycleEventArgs; use \DateTime; class DoctrineLogChangesService […]

  • Zend Framework 2 change layout for ajax requests

    September 15, 2015

    How to change layout for ajax requests in Zend Framework 2 1. Module.php public function onBootstrap(MvcEvent $e) { $e->getApplication() ->getEventManager() ->getSharedManager() ->attach( 'Zend\Mvc\Controller\AbstractController', 'dispatch', function ($e) { $controller = $e->getTarget(); if ($controller->getRequest() instanceof HttpRequest) { if ($controller->getRequest()->isXmlHttpRequest()) { $controller->layout('layout/ajax'); } } }, 100 ); } 2. module.config.php Add the layout path 'view_manager' => array( 'template_map' […]

  • Zend Framework 2 Navigation with ACL in 3 steps

    May 2, 2013

    This post is a  follow up from : zend framework 2 acl in 5 minutes Step 1 Code in config/autoload/global.php 'navigation' => array( 'default'=> array( array( 'label' => 'Home', 'route' => 'home', 'resource'=> 'home', ), array( 'label' => 'Login', 'route' => 'login', 'resource'=> 'login', ), array( 'label' => 'Register', 'route' => 'register', 'resource'=> 'register', ), […]

  • How to get zend framework 2 base path with domain name in layout ?

    March 5, 2013

    There is a easy way to get zend framework 2 base path with domain name in layout. 1. In layout.phtml $homeUrl = $this->url('home',array(),array('force_canonical' => true)); 2.Adding home route in module.config.php 'home' => array( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array( 'route' => '/', 'defaults' => array( 'controller' => 'Application\Controller\Index', 'action' => 'index', ), ), ), Simple […]


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /home/c2kblate/sites/ivangospodinow.com/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048
 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org