1. Go to this page and download the library: Download bez/zfview-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bez / zfview-bundle example snippets
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
/* ... */
new Bez\ZfViewBundle\ZfViewBundle(),
);
/* ... */
return $bundles;
}
namespace FooBundle\Controller;
use Bez\ZfViewBundle\Configuration\Rendering;
/**
*
* @Rendering(layout="FooBundle::layout.phtml")
*/
class SomeController extends Controller
{
/**
* @Rendering("FooBundle:Some:some.phtml")
*/
public function someAction($name)
{
return array(
'name' => $name,
);
}
/**
* @Rendering()
*
* The template name will guessed if none is specified.
* In this example, FooBundle:Some:baz.phtml will be used.
*/
public function bazAction()
{
return array();
}
}
/**
* @Rendering("FooBundle:Some:other.phtml", layout="FooBundle::secondary.phtml")
*/
public function otherAction($name)
{
return array(
'name' => $name,
);
}
/**
* @Rendering(layout="::base.phtml")
*/
class FooController
{
/**
* @Rendering("FooBundle:Foo:bar.phtml", layout="none")
*/
public function barAction()
{
return array();
}
}
/* path/to/some.phtml */
$this->layout('FooBundle::responsive.phtml'); //Define the layout file to use.
$this->placeholder('sidebar')->captureStart();
/* Display stuff */
$this->placeholder('sidebar')->captureEnd();
use Zend\View\Model\ViewModel;
class DefaultController
{
public function indexAction()
{
$content = new ViewModel();
$content->setTemplate('FooBundle:Default:index.phtml')
->setCaptureTo('content'); //Default.
$sideBar = new ViewModel();
$sideBar->setTemplate('FooBundle::sidebar.phtml');
$sideBar->setCaptureTo('sidebar'); //This child-view will be outputted via $this->sidebar in the parent view.
$layout = new ViewModel();
$layout->setTemplate('FooBundle::layout.phtml');
$layout->addChild($content);
$layout->addChild($sideBar);
return $layout;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.