eZ Community » Forums » eZ Publish 5 Platform » blog page Controller

blog page Controller

blog page Controller

Saturday 19 March 2016 6:36:53 pm - 3 replies

haw {% block content %}{% endblock %} know when i open my blog page show me my blog posts DemoController.php -> listBlogPostsAction?but i dont see where we call DemoController{{ render( controller( "eZDemoBundlebig-smile.gif Emoticonemo:listBlogPosts", { 'locationId': currentLocation.id } ) ) }}only {% block content %}{% endblock %}sorry my english)

Modified on Saturday 19 March 2016 7:26:52 pm by Ivan Mukoryak

Monday 21 March 2016 3:30:38 pm

Hi, it is in "eZDemoBundlebig-smile.gif Emoticonemo:listBlogPosts" that "Demo" in the middle is automatically expanded by Symfony to "DemoController"

Wednesday 23 March 2016 2:49:56 pm

I think you need to Know where the resources are defined ?

see here:


and the full and line views are defined and matched with the ContentType here:


Modified on Wednesday 23 March 2016 2:50:51 pm by Ramzi Arfaoui

Wednesday 23 March 2016 3:00:57 pm

After Posting have i understand your Question happy.gif Emoticon

So when you create a blog post object in the backoffice , eZ look first in the ezpublish.yml file if there any definition for the called class object.

Generally, in ezpublish.yml we define just the template to render the object content. That mean: you can access the object data attribute using {{content.getFieldValue('ATTRIBUTE')}}.

If you want to pass extra Information to the template, you can then specify a controller in ezpublish.yml block Like:

                    # Enriched controller, only adding extra parameters
                    controller: "eZDemoBundle:Demo:showBlogPost"
                    # Overriding the template used by the default viewLocation
                    template: "eZDemoBundle:full:blog_post.html.twig"
                        Identifier\ContentType: [blog_post]

This also the best way if you define your own classes later.

When you have to use render controller?

Use case: This is when you fetch sub element or Object under one location (using the Location.id)

Modified on Wednesday 23 March 2016 3:05:44 pm by Ramzi Arfaoui


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

36 542 Users on board!

Forums menu

Proudly Developed with from