Ver Mensaje Individual
  #40 (permalink)  
Antiguo 25/02/2012, 15:15
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Paginator Zend Framework 2.0 beta

Han visto todos los cambios que le hicieron al di del ZendSkeletonApplication

Código PHP:
Ver original
  1. <?php
  2. return array(
  3.     'di' => array(
  4.         'definition' => array(
  5.             'class' => array(
  6.                 'Zend\Mvc\Router\RouteStack' => array(
  7.                     'instantiator' => array(
  8.                         'Zend\Mvc\Router\Http\TreeRouteStack',
  9.                         'factory'
  10.                     ),
  11.                 ),
  12.             ),
  13.         ),
  14.         'instance' => array(
  15.             // Inject the plugin broker for controller plugins into
  16.             // the action controller for use by all controllers that
  17.             // extend it.
  18.             'Zend\Mvc\Controller\ActionController' => array(
  19.                 'parameters' => array(
  20.                     'broker'       => 'Zend\Mvc\Controller\PluginBroker',
  21.                 ),
  22.             ),
  23.             'Zend\Mvc\Controller\PluginBroker' => array(
  24.                 'parameters' => array(
  25.                     'loader' => 'Zend\Mvc\Controller\PluginLoader',
  26.                 ),
  27.             ),
  28.  
  29.             // Setup the View layer
  30.             'Zend\View\Resolver\AggregateResolver' => array(
  31.                 'injections' => array(
  32.                     'Zend\View\Resolver\TemplatePathStack',
  33.                 ),
  34.             ),
  35.             'Zend\View\Resolver\TemplatePathStack' => array(
  36.                 'parameters' => array(
  37.                     'paths'  => array(
  38.                         'application' => __DIR__ . '/../view',
  39.                     ),
  40.                 ),
  41.             ),
  42.             'Zend\View\Renderer\PhpRenderer' => array(
  43.                 'parameters' => array(
  44.                     'resolver' => 'Zend\View\Resolver\AggregateResolver',
  45.                 ),
  46.             ),
  47.             'Zend\Mvc\View\DefaultRenderingStrategy' => array(
  48.                 'parameters' => array(
  49.                     'baseTemplate' => 'layout/layout',
  50.                 ),
  51.             ),
  52.             'Zend\Mvc\View\ExceptionStrategy' => array(
  53.                 'parameters' => array(
  54.                     'displayExceptions' => true,
  55.                     'template'          => 'error/index',
  56.                 ),
  57.             ),
  58.             'Zend\Mvc\View\RouteNotFoundStrategy' => array(
  59.                 'parameters' => array(
  60.                     'notFoundTemplate' => 'error/404',
  61.                 ),
  62.             ),
  63.  
  64.             // Setup the router and routes
  65.             'Zend\Mvc\Router\RouteStack' => array(
  66.                 'parameters' => array(
  67.                     'routes' => array(
  68.                         'default' => array(
  69.                             'type'    => 'Zend\Mvc\Router\Http\Segment',
  70.                             'options' => array(
  71.                                 'route'    => '/[:controller[/:action]]',
  72.                                 'constraints' => array(
  73.                                     'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
  74.                                     'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
  75.                                 ),
  76.                                 'defaults' => array(
  77.                                     'controller' => 'Application\Controller\IndexController',
  78.                                     'action'     => 'index',
  79.                                 ),
  80.                             ),
  81.                         ),
  82.                         'home' => array(
  83.                             'type' => 'Zend\Mvc\Router\Http\Literal',
  84.                             'options' => array(
  85.                                 'route'    => '/',
  86.                                 'defaults' => array(
  87.                                     'controller' => 'Application\Controller\IndexController',
  88.                                     'action'     => 'index',
  89.                                 ),
  90.                             ),
  91.                         ),
  92.                     ),
  93.                 ),
  94.             ),
  95.         ),
  96.     ),
  97. );

https://github.com/zendframework/Zen...ule.config.php

Ahora el ejemplo básico que tenía no me funciona y tampoco el ejemplo de crear módulos del "manual", me sale:

Cita:
Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "album/index"; resolver could not resolve to a file'
Saben como puedo solucionarlo o tienen un ejemplo de como crear modules en esta nueva estructura?

Vi en el controller que hacen esto:

Código PHP:
Ver original
  1. public function indexAction()
  2.     {
  3.         return new ViewModel();
  4.     }

Que hacen con esto? me perdí un poco con estos cambios.

Así es como lo tengo ahora: https://github.com/andresdzphp/zf2b2

Saludos.
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP