Fork me on GitHub

The Zend Framework plugin


This example shows the usage of the Jaxon plugin for the Zend Framework.

The configuration file, the classes and the views are found here.

How it works

Install and configure the Jaxon plugin for Zend, as described in the plugin documentation.

In the application controller, insert the code generated by Jaxon in the page.

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class DemoController extends AbstractActionController
{
    public function indexAction()
    {
        // Call the Jaxon module
        $jaxon = $this->getServiceLocator()->get('JaxonPlugin');
        $jaxon->register();

        $view = new ViewModel(array(
            'JaxonCss' => $jaxon->css(),
            'JaxonJs' => $jaxon->js(),
            'JaxonScript' => $jaxon->script(),
        ));
        $view->setTemplate('demo/index');
        return $view;
    }
}