1. 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.

Discussion in 'Styling and Customization Questions' started by MatthewEnderle, Aug 2, 2012.

  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'
     
  2. NeverMind I figured it out.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    In the EWRblock_RecentNews template:

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

Share This Page