Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme templates for core bundle are not being found #124

Open
vhejda opened this issue May 19, 2015 · 4 comments
Open

Theme templates for core bundle are not being found #124

vhejda opened this issue May 19, 2015 · 4 comments

Comments

@vhejda
Copy link

vhejda commented May 19, 2015

Hello!
I have tried everything already, but I can't seem to get this bundle to work properly. I have this config:

# app/config/config.yml

liip_theme:
    themes: ["Default","Plain"]
    active_theme: "Default"

My application core parts are in src\Core\CoreBundle. I also have a BannerBundle in vendor directory, at for this bundle the themes work just as expected...

I am trying to override my footer template: src\Core\CoreBundle\Resources\views\Footer\footer.html.twig. I tried creating a new template in all 3 ways described in documentation:

Override themes directory: app/Resources/themes/Default/CoreBundle/Footer/footer.html.twig
Override view directory: app/Resources/CoreBundle/views/Footer/footer.html.twig
Bundle theme directory: src/Core/CoreBundle/Resources/themes/Default/Footer/footer.html.twig

...but only the second one works, which is natural Symfony behavior and does not let me create any different themes. For the BannerBundle all these 3 ways override my default template in correct order.

Am I doing something wrong? Or does the theme bundle have problems with the structure of CoreBundle? In docs you say src\BundleName\Resources directly, but I have Core directory between this... I also tried adding the CoreBundle folder inside Core folder in the themes structure, but that doesn't help either.

Thank you in advance!

@oleg-andreyev
Copy link
Contributor

If you wanna override vendors template it must go either into app folder. or you should inherit bundle that you wanna override

@vhejda
Copy link
Author

vhejda commented May 19, 2015

Oleg: No, I want to override my own templates located in src/Core/CoreBundle/Resources/views with different themes (default, plain etc.). None of the ways proposed in the docs here works for me. Thanks!

EDIT: For the record, I call this template this way: $this->render("@Core/Footer/footer.html.twig");. But neither themes\Default\CoreBundle\Footer\footer.html.twig, nor themes\Default\Core\CoreBundle\Footer\footer.html.twig, nor themes\Default\Core\Footer\footer.html.twig overrides the default template. Those are all the combinations that make sense to me...

@oleg-andreyev
Copy link
Contributor

Then probably you need cascading, you need to specify paths where FileLocator should look.

https://github.com/liip/LiipThemeBundle#change-theme-cascading-order

@vhejda
Copy link
Author

vhejda commented May 19, 2015

Oleg: Thank you very much for your time, but I have found a different way to make it work. Calling $this->render("@Core/Footer/footer.html.twig");seemed to be the "error". I had to change all render calls in my controllers to this format: $this->render("CoreBundle:Footer:footer.html.twig");, and it works. I do not know, if this is a bug, or feature/desired behavior :) I will let you decide.

Thank you anyway for this great bundle, keep up the awesome work!

Vojta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants