• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Retrieve Day and Month as separate strings.

#1
Hello, I am trying to create a unique style for my XenPorta Recent News block. I need to display only the day's number of the promotion date.

I managed to find this inside the block's php.
PHP:
foreach ($news AS &$post)
        {
            $strtime = new DateTime(date('r', $post['promote_date']));
            $strtime->setTimezone(new DateTimeZone(XenForo_Application::get('options')->guestTimeZone));
            list($post['month'], $post['day']) = explode('.', $strtime->format('n.d'));
            $post['month'] = new XenForo_Phrase('month_'.$post['month'].'_short');
I tried to put {xen:helper thread, $post['day'])} in a span but it won't let me even save the template. I will also need to get the Month too but I was guessing I can do a if/then for "If &month = 8 then &monthStr = 'Aug'
 

Jake Bunce

XenForo moderator
Staff member
#3
In the EWRblock_RecentNews template:

Code:
Day = {xen:date {$news.post_date}, 'j'}
Month = {xen:date {$news.post_date}, 'M'}