本文整理汇总了PHP中eZTemplate::error方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplate::error方法的具体用法?PHP eZTemplate::error怎么用?PHP eZTemplate::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplate
的用法示例。
在下文中一共展示了eZTemplate::error方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
/**
* Executes the template operator
*
* @param eZTemplate $tpl
* @param string $operatorName
* @param mixed $operatorParameters
* @param string $rootNamespace
* @param string $currentNamespace
* @param mixed $operatorValue
* @param array $namedParameters
* @param mixed $placement
*/
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
{
if (!is_string($namedParameters['name']) && empty($namedParameters['name'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'name' must be a non empty string.", $placement);
return;
}
$templateName = $namedParameters['name'];
if ($namedParameters['parameters'] !== null && !is_array($namedParameters['parameters'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'parameters' must be a hash array.", $placement);
return;
}
$templateParameters = $namedParameters['parameters'] !== null ? $namedParameters['parameters'] : array();
$apiContentConverter = NgSymfonyToolsApiContentConverter::instance();
foreach ($templateParameters as $parameterName => $parameterValue) {
$templateParameters[$parameterName] = $apiContentConverter->convert($parameterValue);
}
$serviceContainer = ezpKernel::instance()->getServiceContainer();
$templatingEngine = $serviceContainer->get('templating');
$operatorValue = $templatingEngine->render($templateName, $templateParameters);
}
示例2: modify
/**
* Executes the template operator
*
* @param eZTemplate $tpl
* @param string $operatorName
* @param mixed $operatorParameters
* @param string $rootNamespace
* @param string $currentNamespace
* @param mixed $operatorValue
* @param array $namedParameters
* @param mixed $placement
*/
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
{
if (!$namedParameters['uri'] instanceof ControllerReference && !(is_string($namedParameters['uri']) && !empty($namedParameters['uri']))) {
$tpl->error($operatorName, "{$operatorName} parameter 'uri' must be a non empty string or a controller reference.", $placement);
return;
}
$uri = $namedParameters['uri'];
if ($namedParameters['options'] !== null && !is_array($namedParameters['options'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'options' must be a hash array.", $placement);
return;
}
$options = $namedParameters['options'] !== null ? $namedParameters['options'] : array();
if ($operatorName === 'symfony_render_esi') {
$options['strategy'] = 'esi';
} else {
if ($operatorName === 'symfony_render_hinclude') {
$options['strategy'] = 'hinclude';
}
}
$operatorValue = self::renderUri($uri, $options);
}
示例3: modify
/**
* Executes the template operator
*
* @param eZTemplate $tpl
* @param string $operatorName
* @param mixed $operatorParameters
* @param string $rootNamespace
* @param string $currentNamespace
* @param mixed $operatorValue
* @param array $namedParameters
* @param mixed $placement
*/
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
{
if (!is_string($namedParameters['name']) && empty($namedParameters['name'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'name' must be a non empty string.", $placement);
return;
}
$name = $namedParameters['name'];
if ($namedParameters['parameters'] !== null && !is_array($namedParameters['parameters'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'parameters' must be a hash array.", $placement);
return;
}
$parameters = $namedParameters['parameters'] !== null ? $namedParameters['parameters'] : array();
if ($operatorName === 'symfony_path') {
$relative = isset($namedParameters['relative']) && $namedParameters['relative'] === true;
$operatorValue = self::getPath($name, $parameters, $relative);
} else {
if ($operatorName === 'symfony_url') {
$schemeRelative = isset($namedParameters['scheme_relative']) && $namedParameters['scheme_relative'] === true;
$operatorValue = self::getUrl($name, $parameters, $schemeRelative);
}
}
}
示例4: modify
/**
* Executes the template operator
*
* @param eZTemplate $tpl
* @param string $operatorName
* @param mixed $operatorParameters
* @param string $rootNamespace
* @param string $currentNamespace
* @param mixed $operatorValue
* @param array $namedParameters
* @param mixed $placement
*/
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
{
if (!is_string($namedParameters['controller']) || empty($namedParameters['controller'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'controller' must be a non empty string.", $placement);
return;
}
$controller = $namedParameters['controller'];
if ($namedParameters['attributes'] !== null && !is_array($namedParameters['attributes'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'attributes' must be a hash array.", $placement);
return;
}
$attributes = $namedParameters['attributes'] !== null ? $namedParameters['attributes'] : array();
if ($namedParameters['query'] !== null && !is_array($namedParameters['query'])) {
$tpl->error($operatorName, "{$operatorName} parameter 'query' must be a hash array.", $placement);
return;
}
$query = $namedParameters['query'] !== null ? $namedParameters['query'] : array();
$apiContentConverter = NgSymfonyToolsApiContentConverter::instance();
foreach ($attributes as $attributeName => $attributeValue) {
$attributes[$attributeName] = $apiContentConverter->convert($attributeValue);
}
$operatorValue = self::getController($controller, $attributes, $query);
}