Comments (7)
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.
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.
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.
@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.
@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.
@wizhippo, yes. In my project I also have fallback to common theme and overrides in specific theme.
from liipthemebundle.
this is now fixed, right?
from liipthemebundle.
Related Issues (20)
- Active theme cached across requests HOT 7
- Trying to use error template HOT 5
- Order of checking locations HOT 1
- Set default theme from database or custom config HOT 8
- Namespaces Tests HOT 1
- Can I force always load first an own bundle ? HOT 1
- Fatal error in FileSystemLoader HOT 3
- Unable to find template "register_content.html.twig|myTheme" in @FOSUser/Registration/register.html.twig at line 4. HOT 3
- Problems overriding twig file systemloader (twig 2.0) HOT 2
- FOSUserBundle with Themes
- Set themes and active themes from PHP code HOT 3
- Custom service as "liip_theme.autodetect_theme" setting HOT 6
- Symfony 4.0 Deprecations HOT 1
- User Deprecated: Passing "false" as the second argument to Symfony\Component\HttpKernel\Kernel::getBundle() is deprecated as of 3.4 and will be removed in 4.0. HOT 1
- This bundle is in maintenance only mode
- Compiler passes are running to early
- ServiceNotFoundException You have requested a non-existent service "twig.loader.filesystem". HOT 5
- Issue when using "traditional" path notation HOT 3
- Can't work overriding for symfony 4.3 templates/bundles HOT 2
- Symfony 5 compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liipthemebundle.