当前位置: 首页>>代码示例>>PHP>>正文


PHP eZTemplateCompiler::generatePHPCodeChildren方法代码示例

本文整理汇总了PHP中eZTemplateCompiler::generatePHPCodeChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateCompiler::generatePHPCodeChildren方法的具体用法?PHP eZTemplateCompiler::generatePHPCodeChildren怎么用?PHP eZTemplateCompiler::generatePHPCodeChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZTemplateCompiler的用法示例。


在下文中一共展示了eZTemplateCompiler::generatePHPCodeChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generatePHPCodeChildren

    static function generatePHPCodeChildren($useComments, $php, $tpl, &$nodeChildren, &$resourceData, &$parameters, $currentParameters)
    {
        foreach ($nodeChildren as $node) {
            $newNode = false;
            $nodeType = $node[0];
            if ($nodeType > eZTemplate::NODE_USER_CUSTOM) {
                // Do custom nodes
            } else {
                if ($nodeType > eZTemplate::NODE_INTERNAL) {
                    // Do custom internal nodes
                    if ($nodeType == eZTemplate::NODE_INTERNAL_CODE_PIECE) {
                        $codePiece = $node[1];
                        $spacing = $currentParameters['spacing'];
                        if (isset($node[2]['spacing'])) {
                            $spacing += $node[2]['spacing'];
                        }
                        $php->addCodePiece($codePiece, array('spacing' => $spacing));
                    } else {
                        if ($nodeType == eZTemplate::NODE_INTERNAL_WARNING) {
                            $warningText = $php->thisVariableText($node[1], 23, 0, false);
                            $warningLabel = false;
                            $warningLabelText = '';
                            if (isset($node[2])) {
                                $warningLabelText = $php->thisVariableText($node[2], 0, 0, false);
                            }
                            $spacing = $currentParameters['spacing'];
                            if (isset($node[3]['spacing'])) {
                                $spacing += $node[3]['spacing'];
                            }
                            $placementText = 'false';
                            if (isset($node[4])) {
                                $placementText = $php->thisVariableText($node[4], 0, 0, false);
                            }
                            $php->addCodePiece("\$tpl->warning( " . $warningLabelText . ", " . $warningText . ", " . $placementText . " );", array('spacing' => $spacing));
                        } else {
                            if ($nodeType == eZTemplate::NODE_INTERNAL_ERROR) {
                                $errorText = $php->thisVariableText($node[1], 21, 0, false);
                                $errorLabel = false;
                                $errorLabelText = '';
                                if (isset($node[2])) {
                                    $errorLabelText = $php->thisVariableText($node[2], 0, 0, false);
                                }
                                $spacing = $currentParameters['spacing'];
                                if (isset($node[3]['spacing'])) {
                                    $spacing += $node[3]['spacing'];
                                }
                                $placementText = 'false';
                                if (isset($node[4])) {
                                    $placementText = $php->thisVariableText($node[4], 0, 0, false);
                                }
                                $php->addCodePiece("\$tpl->error( " . $errorLabelText . ", " . $errorText . ", " . $placementText . " );", array('spacing' => $spacing));
                            } else {
                                if ($nodeType == eZTemplate::NODE_INTERNAL_OUTPUT_READ) {
                                    $variableName = $node[1];
                                    $spacing = $currentParameters['spacing'];
                                    if (isset($node[2]['spacing'])) {
                                        $spacing += $node[2]['spacing'];
                                    }
                                    $textName = eZTemplateCompiler::currentTextName($parameters);
                                    $assignmentType = $node[3];
                                    $assignmentText = $php->variableNameText($variableName, $assignmentType, $node[2]);
                                    $php->addCodePiece("{$assignmentText}\${$textName};", array('spacing' => $spacing));
                                } else {
                                    if ($nodeType == eZTemplate::NODE_INTERNAL_OUTPUT_ASSIGN) {
                                        $variableName = $node[1];
                                        $spacing = $currentParameters['spacing'];
                                        if (isset($node[2]['spacing'])) {
                                            $spacing += $node[2]['spacing'];
                                        }
                                        $textName = eZTemplateCompiler::currentTextName($parameters);
                                        $assignmentType = $node[3];
                                        $assignmentText = $php->variableNameText($textName, $assignmentType, $node[2]);
                                        $php->addCodePiece("{$assignmentText}\${$variableName};", array('spacing' => $spacing));
                                    } else {
                                        if ($nodeType == eZTemplate::NODE_INTERNAL_OUTPUT_INCREASE) {
                                            $spacing = $currentParameters['spacing'];
                                            if (isset($node[1]['spacing'])) {
                                                $spacing += $node[1]['spacing'];
                                            }
                                            $textName = eZTemplateCompiler::currentTextName($parameters);
                                            $php->addCodePiece("if " . ($resourceData['use-comments'] ? "/*TC:" . __LINE__ . "*/" : "") . "( !isset( \$textStack ) )\n" . "    \$textStack = array();\n" . "\$textStack[] = \${$textName};\n" . "\${$textName} = '';", array('spacing' => $spacing));
                                        } else {
                                            if ($nodeType == eZTemplate::NODE_INTERNAL_OUTPUT_DECREASE) {
                                                $spacing = $currentParameters['spacing'];
                                                if (isset($node[1]['spacing'])) {
                                                    $spacing += $node[1]['spacing'];
                                                }
                                                $textName = eZTemplateCompiler::currentTextName($parameters);
                                                $php->addCodePiece("\${$textName} = array_pop( \$textStack );", array('spacing' => $spacing));
                                            } else {
                                                if ($nodeType == eZTemplate::NODE_INTERNAL_OUTPUT_SPACING_INCREASE) {
                                                    $spacing = $node[1];
                                                    $currentParameters['spacing'] += $spacing;
                                                    continue;
                                                } else {
                                                    if ($nodeType == eZTemplate::NODE_INTERNAL_SPACING_DECREASE) {
                                                        $spacing = $node[1];
                                                        $currentParameters['spacing'] -= $spacing;
                                                        continue;
                                                    } else {
//.........这里部分代码省略.........
开发者ID:runelangseid,项目名称:ezpublish,代码行数:101,代码来源:eztemplatecompiler.php


注:本文中的eZTemplateCompiler::generatePHPCodeChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。