Al_Ary Posted April 16, 2016 Report Share Posted April 16, 2016 (edited) Столкнулся с шаблоном, в котором надо выводить отдельно день, месяц и год. Причём месяц буквами на русском, сделал так, но чё-то мне подсказывает, что есть более изящное решение <div class="news-date"> <p class="news-date-day">{$post->date|date_format:"%e"}</p> <p class="news-date-month"> {if $post->date|date_format:"%m" == 01}января{/if} {if $post->date|date_format:"%m" == 02}февраля{/if} {if $post->date|date_format:"%m" == 03}марта{/if} {if $post->date|date_format:"%m" == 04}апреля{/if} {if $post->date|date_format:"%m" == 05}мая{/if} {if $post->date|date_format:"%m" == 06}июня{/if} {if $post->date|date_format:"%m" == 07}июля{/if} {if $post->date|date_format:"%m" == 08}августа{/if} {if $post->date|date_format:"%m" == 09}сентября{/if} {if $post->date|date_format:"%m" == 10}октября{/if} {if $post->date|date_format:"%m" == 11}ноября{/if} {if $post->date|date_format:"%m" == 12}декабря{/if} </p> <p class="news-date-year">{$post->date|date_format:"%Y"}</p> </div> Что-то не нашёл как использовать case в smarty. Edited April 16, 2016 by Al_Ary Quote Link to post Share on other sites
Kors Posted April 16, 2016 Report Share Posted April 16, 2016 Поиск на "Месяц на русском" сразу дает результат:http://forum.simplacms.ru/topic/10005-%D0%B2%D1%8B%D0%B2%D0%BE%D0%B4-%D0%B4%D0%B0%D1%82%D1%8B-%D0%B2-%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%BE%D0%BC-%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B5/ Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.