src/Transformatika/MVC/View.php
public function includeBlock($blockName)
    {
        $blockName = str_replace('/', DIRECTORY_SEPARATOR, $blockName);
        $blockContent = '';
        $blockFile = BASE_PATH . DIRECTORY_SEPARATOR . 'storage' . DIRECTORY_SEPARATOR . 'share' . DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR . $blockName . '.' . $this->config['templateExtension'];

        if (file_exists($blockFile)) {
            $templateTmp = file_get_contents($blockFile);
            preg_match_all("~\{\{\s*(.*?)\s*\}\}~", $templateTmp, $block);
            foreach ($block[1] as $k => $v) {
                if ($v === 'php') {
                    $templateTmp = str_replace('{{php}}', '<?php', $templateTmp);
                } elseif ($v === '/php') {
                    $templateTmp = str_replace('{{/php}}', '?>', $templateTmp);
                } else {
                    $blockTemplate = $this->includeBlock($v);
                    $templateTmp = str_replace('{{' . $v . '}}', $blockTemplate, $templateTmp);
                }
            }
            $blockContent = $templateTmp;
        } else {
            $blockContent = 'FILE NOT FOUND (' . $blockFile . ')';
        }
        return $blockContent;
    }
public function includeBlock($blockName)
    {
        $blockName = str_replace('/', DIRECTORY_SEPARATOR, $blockName);
        $blockContent = '';
        $blockFile = BASE_PATH . DIRECTORY_SEPARATOR . 'storage' . DIRECTORY_SEPARATOR . 'share' . DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR . $blockName . '.' . $this->config['templateExtension'];

        if (file_exists($blockFile)) {
            $templateTmp = file_get_contents($blockFile);
            preg_match_all("~\{\{\s*(.*?)\s*\}\}~", $templateTmp, $block);
            foreach ($block[1] as $k => $v) {
                if ($v === 'php') {
                    $templateTmp = str_replace('{{php}}', '<?php', $templateTmp);
                } elseif ($v === '/php') {
                    $templateTmp = str_replace('{{/php}}', '?>', $templateTmp);
                } else {
                    $blockTemplate = $this->includeBlock($v);
                    $templateTmp = str_replace('{{' . $v . '}}', $blockTemplate, $templateTmp);
                }
            }
            $blockContent = $templateTmp;
        } else {
            $blockContent = 'FILE NOT FOUND (' . $blockFile . ')';
        }
        return $blockContent;
    }
public function includeBlock ( $ blockName ) { $ blockName = str_replace ( '/' , DIRECTORY_SEPARATOR , $ blockName ) ; $ blockContent = '' ; $ blockFile = BASE_PATH . DIRECTORY_SEPARATOR . 'storage' . DIRECTORY_SEPARATOR . 'share' . DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR . $ blockName . '.' . $ this -> config [ 'templateExtension' ] ; if ( file_exists ( $ blockFile ) ) { $ templateTmp = file_get_contents ( $ blockFile ) ; preg_match_all ( "~\{\{\s*(.*?)\s*\}\}~" , $ templateTmp , $ block ) ; foreach ( $ block [ 1 ] as $ k => $ v ) { if ( $ v === 'php' ) { $ templateTmp = str_replace ( '{{php}}' , '<?php' , $ templateTmp ) ; } elseif ( $ v === '/php' ) { $ templateTmp = str_replace ( '{{/php}}' , '?>' , $ templateTmp ) ; } else { $ blockTemplate = $ this -> includeBlock ( $ v ) ; $ templateTmp = str_replace ( '{{' . $ v . '}}' , $ blockTemplate , $ templateTmp ) ; } } $ blockContent = $ templateTmp ; } else { $ blockContent = 'FILE NOT FOUND (' . $ blockFile . ')' ; } return $ blockContent ; }
Include Block Layout
Include Block Layout