fenom pdoResources default tpl
        Вывожу сниппет
{'!pdoResources' | snippet: [
'parents' => $_modx->config['ds-id-events'],
'context' => $_modx->context.key,
'tpl' => '@FILE chunks/header_new_item.tpl',
'limit' => 3,
'depth' => 0,
'includeContent' => 1,
'sortby' => 'publishedon',
'sortdir' => 'ASC'
]}
Как сюда добавить — если результат пустой (default) выводить чанк header_new_item-default.tpl?
    
    
                                                        {'!pdoResources' | snippet: [
'parents' => $_modx->config['ds-id-events'],
'context' => $_modx->context.key,
'tpl' => '@FILE chunks/header_new_item.tpl',
'limit' => 3,
'depth' => 0,
'includeContent' => 1,
'sortby' => 'publishedon',
'sortdir' => 'ASC'
]}
Как сюда добавить — если результат пустой (default) выводить чанк header_new_item-default.tpl?
            
                Поблагодарить автора            
            
                 Отправить деньги            
        
        
            Комментарии: 11
{ var $output = '!pdoResources' | snippet: [
'parents' => $_modx->config['ds-id-events'],
'context' => $_modx->context.key,
'tpl' => '@FILE chunks/header_new_item.tpl',
'limit' => 3,
'depth' => 0,
'includeContent' => 1,
'sortby' => 'publishedon',
'sortdir' => 'ASC'
]}
{if $output}
{$ouptu}
{else}
Ну тут нету
{/if}            
                Мне вот такая запись нравится:
                    {$output ?: 'Ну тут нету'}            {$output ?: 'header_new_item-default.tpl' | chunk}Вдруг не поймёт всё таки            
                Ну в первый вариант легче верстку вставлять)) Второй короче.            
                    {$ouptu}Шалишь?)
                Сделал
            
                    {var $output = 'pdoResources' | snippet: [
            'parents' => $_modx->config['ds-id-events'],
            'context' => $_modx->context.key,
            'tpl' => '@FILE chunks/header_new_item.tpl',
            'limit' => 3,
            'depth' => 0,
            'includeContent' => 1,
            'sortby' => 'publishedon',
            'sortdir' => 'ASC'
          ]}
          {$output ?: 'header_new_item-default.tpl' | chunk}Вот что выводит
            
                Вот как работает
                    {var $output = 'pdoResources' | snippet: [
            'parents' => $_modx->config['ds-id-news'],
            'context' => $_modx->context.key,
            'tpl' => '@FILE chunks/header_new_item.tpl',
            'limit' => 3,
            'sortby' => 'publishedon',
            'sortdir' => 'ASC'
          ]}
          {if $output}
            {$output}
          {else}
            {include 'file:chunks/header_new_item-default.tpl'}
          {/if}            
                Попробуй в скобки взять:
                    {$output ?: ('header_new_item-default.tpl' | chunk)}            
                Да что то мне кажется, ему все таки надо путь указать:
                    {$output ?: include 'file:chunks/header_new_item-default.tpl'}            
                А я и не заметил, что он пытается файловый элемент подтянуть)) Тогда да, всё верно!            
                    
                Не не, без скобок нормально отрабатывает) Просто человек пишет:
                    если результат пустой (default) выводить чанк header_new_item-default.tplЯ и написал как выводить чанк
                            Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.