2016-06-16 2 views
3
이 같은 변수와 구성 요소 내부의 구성 요소를 호출 할

: 여기어떻게 구성 요소 내부 구성 요소를 호출 할 [OctoberCMS]

enter image description here가 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처럼 더 많은 코드를 게시 할 경우

, 그것은 확인

+1

을 스크린 샷 대신 코드를 재사용하여 다른 사람들을 도울 수 있습니다. – Stacked

답변

2

예입니다 : 내 ApplicationForm 구성 요소에 fileUploader 구성 요소를 사용합니다.

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()); 
} 

을 그리고 ApplicationForm 구성 요소의 뷰 (default.htm을) 그렇게 같은 초기화 구성 요소를 사용합니다 : ApplicationForm 클래스에서이 추가 게으른, 포스트 실제 코드 조각하지 마십시오

{% component 'fileUploader' %}