Views: 8531
Last Modified: 12.09.2014

Enhanced template buffering methods permit not to use EndViewTarget() any longer because the end of a template automatically terminates buffering.

Now, there is a standard caching support in components.


  • template.php:
    <?$this->SetViewTarget("sidebar");?>
    
    	<div class="element-filter">
    		<!--filter display -->
    	</div>
    
    <?$this->EndViewTarget();?>
    
    <div class="element-list">
    	<!--list display -->
    </div>
  • header.php:
    <div id="sidebar">
    	<?$APPLICATION->ShowViewContent("sidebar")?>
    </div>

Methods available in a template (through &this)

  • CBitrixComponentTemplate::SetViewTarget($view, $pos)
  • CBitrixComponentTemplate::EndViewTarget()

$APPLICATION global object methods

  • Cmain::AddViewContent($view, $content, $pos)
  • Cmain::ShowViewContent($view)

where:

$view is the buffered area identifier;

$content is the buffered content;

$pos is the sorting of the displayed contents.

Note: Several buffers may correspond to one $view identifiers. The $pos sorting determines the sequence of the content display.



Courses developed by Bitrix24