Created
March 19, 2015 12:38
-
-
Save pafnuty/f62bb969573b1e215af0 to your computer and use it in GitHub Desktop.
Вывод данных в зависимости от значения допполя
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{* | |
Стандарт с хаком от сандера | |
[if xfvalue_activation='Steam']<li><img src="http://haypay.ru/templates/haypay2/images/icons/platform_steam.png" alt=""></li>[/if] | |
[if xfvalue_activation='Sony']<li><img src="http://haypay.ru/templates/haypay2/images/icons/platform_sony.png" alt=""></li>[/if] | |
*} | |
{*Пробегаем по массиву с новостями*} | |
{foreach $list as $key => $el} | |
{if $el.xfields['xfvalue_activation']} {* https://github.com/bzick/fenom/blob/master/docs/ru/tags/if.md *} | |
{* Используем switch для ускорения обработки множественных условий *} | |
{switch $el.xfields['xfvalue_activation']} {* https://github.com/fenom-template/fenom/blob/master/docs/ru/tags/switch.md *} | |
{case 'Steam'} | |
{set $platform = 'platform_steam.png'} | |
{case 'value2', 'Sony'} | |
{set $platform = 'platform_sony.png'} | |
{case default} | |
{set $platform = 'noname.png'} | |
{/switch} | |
<li><img src="http://haypay.ru/templates/haypay2/images/icons/{$platform}" alt="{$el.xfields['xfvalue_activation']}"></li> | |
{/if} | |
{foreachelse} | |
{*Если новостей нет - выведем информацию об этом*} | |
<p>Новостей нет</p> | |
{/foreach} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment