-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Fixes #3535: Syntax changes #3978
Conversation
- Removed `form_begin`, `form_end` - Added `use()` and `ViewRenderer::uses` that are importing classes and namespaces - Added widget dynamic functions `*_begin`, `*_end`, `*_widget`, `widget_end` - Added more tests
*/ | ||
public function getName() | ||
{ | ||
return 'Twig Extension for Yii 2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is allowed name, but I think it should be some kind of identifier because it's used later to access the extension in template: $this->env->getExtension('Twig Extension for Yii 2')->registerAsset($context, "app");
Hi if we use extend in our template site. The use parameter gives this error .. So we have to add this code to our main layout page, but I just want to use it in one page, if I add this main layout it will be called every page .. Is this a normal behaviour ?? user.htm extends main.htm
The error is A template that extends another one cannot have a body But if I add 'use' in main.htm it works. |
I don't quite understand how to reproduce the issue. |
First extend another file in twig for example from index.htm extend main.htm Main.htm is our main layout .. It has body and other functions in it ..
in index.htm
If I use it like this I get the error.. A template that extends another one cannot have a body ... |
@samdark can you reproduce the issue ?? |
Not yet. Would be cool if you'll create a separate ticket for it because it's easy to lose track of issues in closed tocket. |
@cansozeri Try moving the use() statement within a {%block%}, that way it works fine. I agree that it would look cleaner if use statements in child templates could be placed on top of the file, but that's probably a twig limitation? |
form_begin
,form_end
use()
andViewRenderer::uses
that are importing classes and namespaces*_begin
,*_end
,*_widget
,widget_end