src/View/SSTemplateParser.php
function ClosedBlock_Handle_With(&$res)
    {
        if ($res['ArgumentCount'] != 1) {
            throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' .
                'argument only.', $this);
        }

        $arg = $res['Arguments'][0];
        if ($arg['ArgumentMode'] == 'string') {
            throw new SSTemplateParseException('Control block cant take string as argument.', $this);
        }

        $on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
        return
            $on . '; $scope->pushScope();' . PHP_EOL .
                $res['Template']['php'] . PHP_EOL .
            '; $scope->popScope(); ';
    }
function ClosedBlock_Handle_With(&$res)
    {
        if ($res['ArgumentCount'] != 1) {
            throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' .
                'argument only.', $this);
        }

        $arg = $res['Arguments'][0];
        if ($arg['ArgumentMode'] == 'string') {
            throw new SSTemplateParseException('Control block cant take string as argument.', $this);
        }

        $on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
        return
            $on . '; $scope->pushScope();' . PHP_EOL .
                $res['Template']['php'] . PHP_EOL .
            '; $scope->popScope(); ';
    }
function ClosedBlock_Handle_With ( & $ res ) { if ( $ res [ 'ArgumentCount' ] != 1 ) { throw new SSTemplateParseException ( 'Either no or too many arguments in with block. Must be one ' . 'argument only.' , $ this ) ; } $ arg = $ res [ 'Arguments' ] [ 0 ] ; if ( $ arg [ 'ArgumentMode' ] == 'string' ) { throw new SSTemplateParseException ( 'Control block cant take string as argument.' , $ this ) ; } $ on = str_replace ( '$$FINAL' , 'obj' , ( $ arg [ 'ArgumentMode' ] == 'default' ) ? $ arg [ 'lookup_php' ] : $ arg [ 'php' ] ) ; return $ on . '; $scope->pushScope();' . PHP_EOL . $ res [ 'Template' ] [ 'php' ] . PHP_EOL . '; $scope->popScope(); ' ; }
The closed block handler for with blocks
The closed block handler for with blocks