本文整理汇总了PHP中eZTemplateNodeTool::createTextNode方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateNodeTool::createTextNode方法的具体用法?PHP eZTemplateNodeTool::createTextNode怎么用?PHP eZTemplateNodeTool::createTextNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplateNodeTool
的用法示例。
在下文中一共展示了eZTemplateNodeTool::createTextNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templateNodeTransformation
function templateNodeTransformation($functionName, &$node, $tpl, $parameters, $privateData)
{
$newNodes = array();
if ($functionName == $this->LName) {
$newNodes = array(eZTemplateNodeTool::createTextNode($tpl->leftDelimiter()));
} else {
$newNodes = array(eZTemplateNodeTool::createTextNode($tpl->rightDelimiter()));
}
return $newNodes;
}
示例2: templateNodeTransformation
function templateNodeTransformation($functionName, &$node, $tpl, $parameters, $privateData)
{
$useLastValue = false;
if (isset($parameters['last-value']) and !eZTemplateNodeTool::isConstantElement($parameters['last-value'])) {
return false;
}
if (isset($parameters['name']) and !eZTemplateNodeTool::isConstantElement($parameters['name'])) {
return false;
}
if (isset($parameters['var']) and !eZTemplateNodeTool::isConstantElement($parameters['var'])) {
return false;
}
if (isset($parameters['reverse']) and !eZTemplateNodeTool::isConstantElement($parameters['reverse'])) {
return false;
}
$varName = false;
if (isset($parameters['var'])) {
$varName = eZTemplateNodeTool::elementConstantValue($parameters['var']);
}
if (isset($parameters['last-value'])) {
$useLastValue = (bool) eZTemplateNodeTool::elementConstantValue($parameters['last-value']);
}
if (!$varName) {
$useLastValue = false;
}
$reverseLoop = false;
if (isset($parameters['reverse'])) {
$reverseLoop = eZTemplateNodeTool::elementConstantValue($parameters['reverse']);
}
$useLoop = isset($parameters['loop']);
$allowLoop = true;
$newNodes = array();
$maxText = "false";
$useMax = false;
$maxPopText = false;
if (isset($parameters['max'])) {
if (eZTemplateNodeTool::isConstantElement($parameters['max'])) {
$maxValue = eZTemplateNodeTool::elementConstantValue($parameters['max']);
if ($maxValue > 0) {
$maxText = eZPHPCreator::variableText($maxValue);
$useMax = true;
} else {
return array(eZTemplateNodeTool::createTextNode(''));
}
} else {
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $parameters['max'], eZTemplateNodeTool::extractFunctionNodePlacement($node), array(), 'max');
$maxText = "\$max";
$maxPopText = ", \$max";
$useMax = true;
}
}
// Controls whether the 'if' statement with brackets is added
$useShow = false;
// Controls whether main nodes are handled, also controls delimiter and filters
$useMain = true;
// Controls wether else nodes are handled
$useElse = false;
$spacing = 0;
if (isset($parameters['show'])) {
if (eZTemplateNodeTool::isConstantElement($parameters['show'])) {
$showValue = eZTemplateNodeTool::elementConstantValue($parameters['show']);
if ($showValue) {
$useMain = true;
$useElse = false;
$useShow = false;
} else {
$useMain = false;
$useElse = true;
$useShow = false;
}
$newNodes[] = eZTemplateNodeTool::createTextNode('');
} else {
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $parameters['show'], eZTemplateNodeTool::extractFunctionNodePlacement($node), array(), 'show');
$spacing = 4;
$useElse = true;
$useShow = true;
}
}
$children = eZTemplateNodeTool::extractFunctionNodeChildren($node);
if ($useShow) {
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("if ( \$show )\n{\n");
$newNodes[] = eZTemplateNodeTool::createSpacingIncreaseNode($spacing);
$newNodes[] = eZTemplateNodeTool::createVariableUnsetNode('show');
}
if (isset($parameters['name']) and !$useLoop) {
$newNodes[] = eZTemplateNodeTool::createNamespaceChangeNode($parameters['name']);
}
$mainNodes = eZTemplateNodeTool::extractNodes($children, array('match' => array('type' => 'before', 'matches' => array(array('match-keys' => array(0), 'match-with' => eZTemplate::NODE_FUNCTION), array('match-keys' => array(2), 'match-with' => 'section-else')), 'filter' => array(array(array('match-keys' => array(0), 'match-with' => eZTemplate::NODE_FUNCTION), array('match-keys' => array(2), 'match-with' => array('delimiter', 'section-exclude', 'section-include')))))));
$delimiterNodes = eZTemplateNodeTool::extractNodes($children, array('match' => array('type' => 'equal', 'matches' => array(array('match-keys' => array(0), 'match-with' => eZTemplate::NODE_FUNCTION), array('match-keys' => array(2), 'match-with' => 'delimiter')))));
$filterNodes = eZTemplateNodeTool::extractNodes($children, array('match' => array('type' => 'equal', 'matches' => array(array('match-keys' => array(0), 'match-with' => eZTemplate::NODE_FUNCTION), array('match-keys' => array(2), 'match-with' => array('section-exclude', 'section-include'))))));
$delimiterNode = false;
if (count($delimiterNodes) > 0) {
$delimiterNode = $delimiterNodes[0];
}
if ($useMain) {
// Avoid transformation if the nodes will not be used, saves time
$mainNodes = eZTemplateCompiler::processNodeTransformationNodes($tpl, $node, $mainNodes, $privateData);
}
if ($useLoop and $useMain) {
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $parameters['loop'], eZTemplateNodeTool::extractFunctionNodePlacement($node), array(), 'loopItem');
//.........这里部分代码省略.........
示例3: appendDebugNodes
function appendDebugNodes(&$root, &$resourceData)
{
$path = $resourceData['template-filename'];
$uri = $resourceData['uri'];
$preText = "\n<!-- START: including template: {$path} ({$uri}) -->\n";
if (eZTemplate::isXHTMLCodeIncluded()) {
$preText .= "<p class=\"small\">{$path}</p><br/>\n";
}
$postText = "\n<!-- STOP: including template: {$path} ({$uri}) -->\n";
$root[1] = array_merge(array(eZTemplateNodeTool::createTextNode($preText)), $root[1]);
$root[1][] = eZTemplateNodeTool::createTextNode($postText);
}