Git Product home page Git Product logo

Comments (7)

lsmith77 avatar lsmith77 commented on August 22, 2024

it should be possible to extend a template in the standard location from a theme folder. this is infact what most users of this Bundle do. so there must be something else going wrong here. can you provide more information (exact locations of the templates and the code which does the extend). if possible also a stack trace ..

btw is this in the dev or prod env and if its in the prod env, are you using cache warming?

from liipthemebundle.

wizhippo avatar wizhippo commented on August 22, 2024

This is on dev.

Templates involved are located at:

MyBundle/Resources/views/full/landing_page.html.twig
and
MyBundle/Resources/themes/site1/pagelayout.html.twig
and
MyBundle/Resources/views/pagelayout.html.twig

Here is a gist with the stacktrace and striped examples of the twig templates. As the gist won't allow subdirs I have separated them by underscores.

https://gist.github.com/wizhippo/6f5504045318118fcfa7

You can see it gets the landing_page.html.twig:
/var/www/example.com/ezpublish/cache/dev/twig/23/1d/b51e0a5626157c99a0d450174e204a9aac5222f4b9a37321eda846494786.php

Then gets the site1/pagelayout.html.twig which is the correct theme

/var/www/ezdev.travelonly.com/ezpublish/cache/dev/twig/13/af/8272311c40865a08e9264621eb8c3e3b341b2b46d19c883f312f75d9feb9.php

But this has

    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("MyBundle::pagelayout.html.twig");

        $this->blocks = array(
            'header' => array($this, 'block_header'),
        );
    }

This in turn keep getting itself instead of views/pagelayout.html.twig

from liipthemebundle.

lsmith77 avatar lsmith77 commented on August 22, 2024

hmm not sure why this is not working. maybe @stof has a hint?
alternatively I guess could you make a fork of https://github.com/liip-forks/symfony-standard and add a reproduce-able test case as an example?

from liipthemebundle.

oleg-andreyev avatar oleg-andreyev commented on August 22, 2024

@wizhippo can you provide your liip_theme config?

IIRC it's impossible to include/extend template with the same name from another theme (folder), simply because LiipThemeBundle / Locator / FileLocator check paths from path_patterns first, and when you're trying to include/extend template with same name FileLocator matches template from your theme.

To overcome this issue you should rename your MyBundle::pagelayout.html.twig

from liipthemebundle.

wizhippo avatar wizhippo commented on August 22, 2024

@oleg-andreyev Thanks for the clarification.

So is the better way to handle this to create a default theme and place the templates there instead of the standard bundle templates, and have the path_patterns setup to fallback to the default theme?

Perhaps this could be added to the common pitfalls?

I did find a workaround. I can refer to MyBundle::pagelayout.html.twig as @MyBundle/pagelayout.html.twig in the the theme template and it works.

from liipthemebundle.

oleg-andreyev avatar oleg-andreyev commented on August 22, 2024

@wizhippo, yes. In my project I also have fallback to common theme and overrides in specific theme.

from liipthemebundle.

lsmith77 avatar lsmith77 commented on August 22, 2024

this is now fixed, right?

from liipthemebundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.