The router is null because the view helper is not connected to an MVC
application - that's quite normal

You're trying to render a page alone with a completely detached
PhpRenderer, which basically has nothing initialized :)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 27 May 2013 11:00, Razorblade <[email protected]> wrote:

> Hi Marco,
> I added the Resolver as described in the documentation
>
>
> http://framework.zend.com/manual/2.0/en/modules/zend.view.renderer.php-renderer.html
>
> this is my code
>
>
>             $renderer = new PhpRenderer();
>             $resolver = new Resolver\AggregateResolver();
>             $renderer->setResolver($resolver);
>             $map = new Resolver\TemplateMapResolver(array(
>                     'mypaginator' => dirname(dirname(dirname(__DIR__))) .
> '/view/mypaginator.phtml'
>             ));
>             $stack = new Resolver\TemplatePathStack(array(
>                     'script_paths' => array(
>                             dirname(dirname(dirname(__DIR__))) . '/view'
>                     )
>             ));
>             $resolver->attach($map)
>             ->attach($stack);
>
>             $html = $renderer->paginationControl($paginator,
>                 'Sliding',
>                 array('mypaginator', 'Mymodule'),
>                 array('route' => 'paginator')
>             );
>
>
> If in the view script "mypaginator.phtm" I have a call to the url()  view
> helper, this exception is raised
>
>
> Message:
>
>     No RouteStackInterface instance provided
>
>
> I've noted that the Url helper raise this exception when $this->router is
> null, but I don't understand why is null.
>
> Call the paginationControl helper directly in the action view script
> doesn't
> give any problem, it works.
>
>
> Thanks
>
>
>
> -----
> Sergio Rinaudo's Blog
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-Get-paginator-output-in-a-non-view-context-tp4660107p4660113.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
>

Reply via email to