Example #1
0
 /**
  * Creates the PHP code for the given array of blocks.
  *
  * @param array  $arBlocks   Array of blocks, see getBlocks()
  * @param string $strTplName Template reference name
  * @param string $strPrefix  Prefix to prepend before the code
  *
  * @return string PHP code
  */
 function getCodeBlock($arBlocks, $strTplName, $strPrefix = '$tpl')
 {
     $nl = "\r\n";
     $code = '';
     foreach ($arBlocks as $arBlock) {
         if (count($arBlock['sub']) > 0) {
             $code .= HTML_Template_PHPLIB_Generator::getCodeBlock($arBlock['sub'], $strTplName, $strPrefix);
         }
         $code .= $strPrefix . "->setBlock('" . $strTplName . "','" . $arBlock['name'] . "', '" . $arBlock['name'] . "_ref');" . $nl;
     }
     return $code;
 }