XF 2.3 ErrorException: Template error: [E_USER_WARNING] Template public:custom_addons is unknown

mrcelebs

Участники
Сообщения
4
Реакции
0
Баллы
3,303
Добрый день. Хотел вывести данный код в собственный шаблон, но получаю ошибку.

ErrorException: Template error: [E_USER_WARNING] Template public:custom_addons is unknown
src\XF\Template\Templater.php:781

Установлен чистый xenForo 2.3.4 Release Edition By XenForo.Info на ospanel без дополнений. Можно это как-то исправить?

PHP:
    namespace XenAddons\myteg;

    class myteg {

   public static function td($tagChildren, $tagOption, $tag, array $options, \XF\BbCode\Renderer\AbstractRenderer $renderer)
{
    $res = $renderer->renderSubTree($tagChildren, $options);
    $toptions = trim(strip_tags($tag['option']));
    $toptions = preg_split("|,|", $toptions, -1, PREG_SPLIT_NO_EMPTY);
    // [td={IDENTIFIER},{NUMBER1},{NUMBER2}]{TEXT}[/td]
    @list($class, $num1, $num2) = $toptions;
    if ($tmp = trim($class)) {
        $classTag = "class=\"$tmp\"";
    }
    if ($tmp = trim($num1)) {
        $rowSpan = "rowspan=\"$tmp\"";
    }
    if ($tmp = trim($num2)) {
        $colSpan = "colspan=\"$tmp\"";
    }
   
    /* We create the template and pass the parameters*/
    $templater = $renderer->getTemplater();
    $customTemplate = $templater->renderTemplate('public:custom_addons', [
        'classTag' => $classTag,
        'rowSpan' => $rowSpan,
        'colSpan' => $colSpan,
        'res' => $res,
    ], true);

    return $customTemplate;
   
}
   
    }

Содержимое шаблона custom_addons

PHP:
<td {$classTag} {$rowSpan} {$colSpan}>{$res}</td>

#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', 'F:\\OSPanel\\OSPa...', 781)
#1 src\XF\Template\Templater.php(781): trigger_error('Template public...', 512)
#2 src\XF\Template\Templater.php(1766): XF\Template\Templater->getTemplateData('public', 'custom_addons')
#3 src\addons\XenAddons\myteg\myteg.php(26): XF\Template\Templater->renderTemplate('custom_addons', Array, true)
#4 src\XF\BbCode\Renderer\Html.php(356): XenAddons\myteg\myteg::td(Array, '{IDENTIFIER},{N...', Array, Array, Object(XF\BbCode\Renderer\SimpleHtml))
#5 src\XF\BbCode\Traverser.php(63): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#6 src\XF\BbCode\Traverser.php(39): XF\BbCode\Traverser->renderSubTree(Array, Array)
#7 src\XF\BbCode\Traverser.php(22): XF\BbCode\Traverser->renderAst(Array, Object(XF\BbCode\RuleSet), Array)
#8 src\XF\SubContainer\BbCode.php(236): XF\BbCode\Traverser->render('[td={IDENTIFIER...', Object(XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
#9 src\XF\Service\Message\PreparerService.php(356): XF\SubContainer\BbCode->render('[td={IDENTIFIER...', 'simpleHtml', 'post:prepare', Object(XF\Entity\Post))
#10 src\XF\Service\Message\PreparerService.php(143): XF\Service\Message\PreparerService->checkValidity('[td={IDENTIFIER...')
#11 src\XF\Service\Post\PreparerService.php(103): XF\Service\Message\PreparerService->prepare('[td={IDENTIFIER...', true)
#12 src\XF\Service\Post\EditorService.php(134): XF\Service\Post\PreparerService->setMessage('[td={IDENTIFIER...', true, true)
#13 src\XF\Pub\Controller\PostController.php(87): XF\Service\Post\EditorService->setMessage('[td={IDENTIFIER...')
#14 src\XF\Pub\Controller\PostController.php(156): XF\Pub\Controller\PostController->setupPostEdit(Object(XF\Entity\Post))
#15 src\XF\Mvc\Dispatcher.php(362): XF\Pub\Controller\PostController->actionEdit(Object(XF\Mvc\ParameterBag))
#16 src\XF\Mvc\Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'Edit', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\PostController), NULL)
#17 src\XF\Mvc\Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\PostController), NULL)
#18 src\XF\Mvc\Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src\XF\App.php(2826): XF\Mvc\Dispatcher->run()
#20 src\XF.php(806): XF\App->run()
#21 index.php(23): XF::runApp('XF\\Pub\\App')
#22 {main}
[/SPOILER]

array(4) {
["url"] => string(23) "/index.php?posts/1/edit"
["referrer"] => string(63) " "
["_GET"] => array(1) {
["posts/1/edit"] => string(0) ""
}
["_POST"] => array(9) {
["_xfToken"] => string(8) "********"
["_xfInlineEdit"] => string(1) "1"
["title"] => string(49) "Экспериментальная новость"
["message"] => string(98) "[td={IDENTIFIER},{NUMBER1},{NUMBER2}]{TEXT}[/td]
[td={IDENTIFIER},{NUMBER1},{NUMBER2}]{TEXT}[/td]"
["attachment_hash"] => string(32) "080ddc867a526de07614f5bfc762685d"
["attachment_hash_combined"] => string(81) "{"type":"post","context":{"post_id":1},"hash":"080ddc867a526de07614f5bfc762685d"}"
["_xfResponseType"] => string(4) "json"
["_xfWithData"] => string(1) "1"
["_xfRequestUri"] => string(46) "/index.php?threads/eksperimentalnaya-novost.1/"
}
}
 
Последнее редактирование:
Современный облачный хостинг провайдер | Aéza
Назад
Сверху Снизу