Calling Developers!
We are reenergizing our code contribution process! Learn More

How can we print data coming from controller in homepage?

sunil Software Engineer Posts: 5 🧑🏻‍🚀 - Cadet

Hi Everyone, I am trying to print a simple Hello World data coming from controller and wanted it to be printed on homepage/frontend(same as in the hello world backoffice;lp=83)but in fontend.

For that i created a folder (Demo) in src\Pyz\Yves

in that

a controller file



namespace Pyz\Yves\Demo\Communication\Controller;

use Spryker\Zed\Kernel\Communication\Controller\AbstractController;

class IndexController extends AbstractController
* @return array
public function indexAction()
return $this->viewResponse([
'helloWorldText' => 'Hello World!'


and a twig file in src\Pyz\Yves\Demo\Theme\default\views\Index\index.twig

{% extends template('page-blank') %}

{{ helloWorldText }}

{% endblock %}

Now , how can i call this from home.twig or any other twig file to show this on frontend

what steps are missing in this?


  • Hidran Arias
    Hidran Arias Senior Technical Trainer Sprykee Posts: 73 🏛 - Council (mod)

    Hi Sunil,

    Here is an example in the docs.

    In Yves it works a little bit different as you need to register the route in the Router module by creating a Router plugin.

    Also, the way themes work is different from the backoffice. You can go deeper into Yves, by following Frontend for backend developers course.
    In that course you´ll learn also how to override views, create widgets to include in different pages

  • harry
    harry Developer Posts: 9 🧑🏻‍🚀 - Cadet
    edited January 29


    the home page is loading from controller


    You can print the data of "hello world" module in the home page corner but it's not simple.

    you need pass "hello world"data at the zed business layer and throw it into the facade instead.

    also you need declare provider in the "home page" module, take it according the communication factory layer and you can load "hello world" data at "hello world" controller.