What are the Slack Archives?

Itโ€™s a history of our time together in the Slack Community! Thereโ€™s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you wonโ€™t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hello All, I am creating a new controller and trying to print a hello world, but getting unable to f

U028VTHNMF1
U028VTHNMF1 Posts: 64 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

Hello All,
I am creating a new controller and trying to print a hello world, but getting unable to find template error, can anyone tell what is the issue

Comments

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 โš–๏ธ - Guardians (admin)

    Hey @U028VTHNMF1, did you create the template?

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
  • U028VTHNMF1
    U028VTHNMF1 Posts: 64 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @florian.scholz yes.
    I have done the below
    1. Created a new folder HelloSpryker inside /src/Pyz/Yves
    2. Created a new folder Communication inside the HelloSpryker folder
    3. Created a new folder Controller inside the Communication folder
    4. Created a new file IndexController.php and added the below code
    <?php
    namespace Pyz\Zed\HelloWorld\Communication\Controller;
    use Spryker\Zed\Kernel\Communication\Controller\AbstractController;
    use Symfony\Component\HttpFoundation\Request;

    class IndexController extends AbstractController
    {
    /**

    • @param Request $request
      */
      public function indexAction(Request $request)
      {
      return ['string' => 'Hello Spryker Welcome....!'];
      }
      }
  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 โš–๏ธ - Guardians (admin)

    The link @UNGMX0012 posted has steps. Please have a look at step 5 to create the template

  • U028VTHNMF1
    U028VTHNMF1 Posts: 64 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
    1. Created another folder Presentation inside HelloSpryker
    2. Created a folder Index inside Presentation
    3. Inside Index folder created a new file index.twig and added the below code {% extends '@Gui/Layout/layout.twig' %}

    {% block content %}
    {{ string }}
    {% endblock %}

  • U028VTHNMF1
    U028VTHNMF1 Posts: 64 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @florian.scholz i created by following that link only

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 โš–๏ธ - Guardians (admin)

    You are talking about Yves-Module, right? Please follow the link posted in this thread - it seems you are following a guide for modules in Zed. Please read https://documentation.spryker.com/docs/tutorial-hello-world-scos again

  • U028VTHNMF1
    U028VTHNMF1 Posts: 64 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    no, i am talking about zed module. I am trying to create display the string in zed module

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 โš–๏ธ - Guardians (admin)

    ok, so we talk about Zed. in your step 1 you wrote โ€œCreated a new folder HelloSpryker inside /src/Pyz/Yvesโ€ - was it a typo or did you create it in yves?

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @U028VTHNMF1 ok, you are talking about a ZED module. it works a you wrote, you are just mixing a few things. You are saying โ€œHelloSprykerโ€ folder but using HelloWorld namespace. Also you said you created a Yves module but are looking ZED. also try to send your code with syntax highlighting using ```

    create your folder structure as you described in ZED, use right namespace and it will work. controller should look sth like this:

    ```<?php

    namespace Pyz\Zed\HelloSpryker\Communication\Controller;

    use Spryker\Zed\Kernel\Communication\Controller\AbstractController;
    use Symfony\Component\HttpFoundation\Request;

    class IndexController extends AbstractController
    {
    /**
    * @param Request $request
    */
    public function indexAction(Request $request)
    {
    return ['string' => 'Hello Spryker Welcome....!'];
    }
    }```