How to define block in control template?
Notice: This thread is very old.
- Tauras
- Member | 3
Hello,
Every control can have their own behaviour and thus their own javascript file.
What is the proper way to get this working:
@layout.latte
<html>
<head>
{include #head}
</head>
<body>
{include #content}
</body>
</html>
MyPresenter.default.latte
{block #head}
<script src="mypresenter.js"></script>
{/block}
{block #content}
<p>My content</p>
{control myForm}
{/block}
MyForm.latte
{block #head}
<script src="myform.js"></script>
{/block}
{form myForm}
...
{/form myForm}
I would expect this to generate
<head>
<script src="mypresenter.js"></script>
<script src="myform.js"></script>
</head>
- HosipLan
- Moderator | 4668
Template is an object, that contains template of given path (view of presenter) and can extend another template (layout). Then, there are controls. Control is ascendant of Presenter and nad contains common logic for creating template. The template of presenter and template of controls are separated and there is no interaction between them.
Control is independent from presenter and the behaviour you're seeking cannot be done the way you wan't it. We have webloader for tasks like this.