Как мне вызвать компонент внутри компонента [OctoberCMS]

Я хочу вызвать компонент внутри компонента с переменной, например так:введите описание изображения здесь

Вот код default.html->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<div class="container">
<div class="row">
{% partial __SELF__ ~ "::category" category=__SELF__.category childscategory=__SELF__.childscategory%}
<div class="col-xs-3">
<strong>DATA</strong>
<ul class="list-group text-center">
{% partial __SELF__ ~ "::dates" files=__SELF__.files  %}
</ul>
</div>

<div class="col-xs-3">
<strong>Nome do Ficheiro</strong>
<ul class="list-group text-center">
{% partial __SELF__ ~ "::files" files=__SELF__.files  %}
</ul>
</div>

<div class="col-xs-3">
<strong>Descrição</strong>
<ul class="list-group text-center">
{% partial __SELF__ ~ "::description" files=__SELF__.files %}
</ul>
</div>

<div class="col-xs-1">
<strong>{{__SELF__.labelpresentation}}</strong>
<ul class="list-group text-center">
{% partial __SELF__ ~ "::download_1" files=__SELF__.files %}
</ul>
</div>
-> I WANT TO CALL THE COMPONENT HERE <-
</div>
</div>

Если вы хотите, чтобы я опубликовал больше кода, например .php, все в порядке

4

Решение

Пример: используйте компонент fileUploader в моем компоненте ApplicationForm. В классе ApplicationForm добавьте это:

public function init()
{
$component = $this->addComponent(
'Responsiv\Uploader\Components\FileUploader',
'fileUploader',
[
'deferredBinding'   => true,
'maxSize'           => $this->property('maxFileSize'),
'fileTypes'         => $this->property('fileTypes'),
'placeholderText'   => $this->property('placeholderText'),
]
);

$component->bindModel('cv', new Application());
}

И в представлении (default.htm) компонента ApplicationForm используйте инициализированный компонент следующим образом:

{% component 'fileUploader' %}
5

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector