eZ Community » Forums » eZ Publish 5 Platform » block content twig
expandshrink

block content twig

block content twig

Friday 14 February 2014 3:24:56 pm - 3 replies

Hello,

I have a mystery I can't resolve in my template. I have my homepage template that I define in my parameters.yml :

ezpublish_legacy.Mysiteaccess.view_default_layout: 'MyBundle::pagelayout.html.twig'

In this template I define a block named 'content' :

{% block contents %}
         in Block Content:
 {% endblock %}

But I have nothing on my browser. But it's visible when I name it 'contents' or 'wathever'....

Is anyone now why ??

 

Thanks

Friday 14 February 2014 3:55:13 pm

Hi,

The block is supposed to be called "content" not "contentS" happy.gif Emoticon

Example: https://github.com/ezsystems/DemoBundle/blob/master/Resources/views/pagelayout.html.twig#L42

Cheers

Modified on Friday 14 February 2014 3:55:26 pm by Damien Pobel

Friday 14 February 2014 3:59:38 pm

The ezpublish_legacy.Mysiteaccess.view_default_layout setting is for setting which pagelayout tpl is going to be called for legacy content/view module. It should have "content" block  ( {% block content %}{% endblock %}) where the legacy module will inject the result.

The question is what are you trying to do?

Friday 14 February 2014 4:46:56 pm

Indeed I have a result with:

{%block content%}
            {%if module_result.content%}
                {{ module_result.content|raw}}
            {%endif%}
{% endblock %}

I'm starting a project on ez 5.2 so I don't need to use tpl in Front End (I don't need any legacy in FO?). As Symfony develloper It was strange to have no result in a block define in a template.

Your Demobundle will help me thanks.

About templating organization :

I have to siteaccess (hosts). So I created 2 specific bundle and on common bundle which share layout for article (for example). Do you think it's a good oraganization ?

What the difference if I define my routes in routing.yml  or if I define a controller and a template in ezpublish.yml ?

I hope my questions are clear.

Thanks

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from