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! I'm having trouble working through the Bootcamp and am hoping someone can help me. I'm tryi

U01A958FBGQ
U01A958FBGQ Posts: 15 🧑🏻‍🚀 - Cadet

Hello! I'm having trouble working through the Bootcamp and am hoping someone can help me. I'm trying to complete the HelloSpryker lesson. I have written all the PHP and twig files per the instructions. When I browse to "http://www.de.b2b-demo-shop.local/en/hello-spryker" I get the error: Twig\Error\LoaderError - Template "@HelloSpryker/index/index.twig" is not defined (Spryker\Shared\Twig\TwigFilesystemLoader: Unable to find template "index/index.twig" (looked into: /data/shop/development/current/src/Pyz/Yves/HelloSpryker/Theme/default).).

The index.twig file exists in "/data/shop/development/current/src/Pyz/Yves/HelloSpryker/Theme/default/views/index" but from the error message it looks like Spryker is looking for "index/index.twig" instead of "views/index/index.twig". Does anyone have any ideas on how to fix this or what I might be doing wrong?

I'm using Vagrant on macOS per the instructions here: https://documentation.spryker.com/v4/docs/installation-guide-b2b

Thanks in advance!

Comments

  • U018XELUZS9
    U018XELUZS9 Posts: 167 🧑🏻‍🚀 - Cadet

    Hi @U01A958FBGQ, there are two ways to solve that:
    1. Use @HelloSpryker/views/index/index.twig in your controller
    2. Move the file from Theme/default/views/index/index.twig to Theme/default/index/index.twig

  • U018XELUZS9
    U018XELUZS9 Posts: 167 🧑🏻‍🚀 - Cadet

    You can also look how this is handled in other places:

  • U0121G9LVNC
    U0121G9LVNC Posts: 27 🧑🏻‍🚀 - Cadet

    I stumbled in the same spot in the Bootcamp. It think this should be corrected.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    @UJN2JRU4F 👆

  • U01A958FBGQ
    U01A958FBGQ Posts: 15 🧑🏻‍🚀 - Cadet

    Thanks for the help on this! Removing the views folder from the index.twig path did the trick. I did also run into a subsequent issue saying that "_view" does not exist in index.twig but I think I can edit that out and proceed with the bootcamp. Thanks again!

  • U01A958FBGQ
    U01A958FBGQ Posts: 15 🧑🏻‍🚀 - Cadet

    @U018XELUZS9, I just looked again at your response and while removing "views" from the file path did fix the issue, I've always had @HelloSpryker/views/index/index.twig as the line in my controller. It's as though the "views" part of my controller string is being ignored. Any advice or ideas?

  • i will have another look at this later. theoretically it should work as is (and has ever since), with our without ‘views’, depending on what you put in the controller.