This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » eZ Publish 5 Platform » Render controller in a block distinct...

Render controller in a block distinct than content

Render controller in a block distinct than content

Saturday 18 May 2013 2:57:32 pm - 1 reply

Hi. i defined an article.html.twig template to show my articles. 

This article template looked like

{% block content %}
render fields here
even render custom controllers for showing needed stuff
<span style="font-size: 1.1em;">{% endblock %}</span>

And thats work perfectly. 

But then, i thought in adding a new controller  for showing Facebook Metadata related stuff. I mean, for adding to the head of my articles pages, things like 

 <meta property="og:title" content="{{ title }}"/>

So, my pagelayout.html.twig looks now like 

 <title>{% block title_page %}{% endblock %}</title>
{% include 'MyBundle::page_head.html.twig' %}
{% block og %}
{# here should be my facebook related metatags #}
{% endblock %}

And my article.html.twig looks like

{% extends noLayout ? viewbaseLayout : "SillonbolWebBundle::pagelayout.html.twig" %}
{% block title_page %}
{% spaceless %}
   {{ }}
{% endspaceless %}
{% endblock %}
{% block og %}
{{ render( controller( "MyBundle:Articles:getFbMetas",     { 'contentId': } )) }}
{% endblock %}
{% block content %}
{# render fields here #}
{% endblock %} 

But i'm getting an exception motivated for that call to the render function. The exception is like this

 <span style="font-size: 1.1em;">An exception has been thrown during the rendering of a template
 ("Catchable Fatal Error: Argument 1 passed to 
 must be an instance of eZ\Publish\Core\MVC\Symfony\View\Manager, 
none given, called in /.../vendor/symfony/symfony/src/Symfony/Bundle/
on line 78 and defined in /.../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/
line 28")</span>

This exception dissapear if a move that call to inside the content block. 

Any ideas on how to solve this? Or probably i'm doing it in a totally wrong way?

Monday 20 May 2013 9:52:21 pm

Forget this. I got it working after change the use statements in my controller. 


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from