Search
Other Articles Anywhere questions
Forum

If statement based on day of the week

Vinny Hebert's Avatar Vinny Hebert
 {if date('today', 'l')='Wednesday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]
      {else}
     [link][show-image][/link]
 {/if}   

I"m trying to display something based on the current day of the week. All the images are showing the border rather than just one.
Peter van Westen's Avatar Peter van Westen ADMIN
You are currently outputting the image with a border if today is Wednesday. It is, so that is correct.
Tomorrow they will be without a border.

If you want to check the date of the article (created/modified date), instead of the current date, then you need to tell Articles Anywhere to check for that.
Please post a rating at the Joomla! Extensions Directory
Vinny Hebert's Avatar Vinny Hebert
However it's not working. They are all showing a border but I believe it has something to do with the way AA loops and I'm not isolating the right image
{articles category="Shows" status="Current" ordering="day-of-the-week ASC"}
 <div class="uk-width-1-1">
 {if day-of-the-week:text='Monday'}
 <h3 class="uk-card-title uk-margin-remove-bottom">Monday</h3>
 {elseif day-of-the-week:text='Tuesday'}
 <h3 class="uk-card-title uk-margin-remove-bottom">Tuesday</h3>
 {elseif day-of-the-week:text='Wednesday'}
 <h3 class="uk-card-title uk-margin-remove-bottom">Wednesday</h3>
 {elseif day-of-the-week:text='Thursday'}
 <h3 class="uk-card-title uk-margin-remove-bottom">Thursday</h3>
 {elseif day-of-the-week:text='Friday'}
 <h3 class="uk-card-title uk-margin-remove-bottom">Friday</h3>
 {elseif day-of-the-week:text='Saturday'}
 <h3 class="uk-card-title uk-margin-remove-bottom">Saturday</h3>
 {/if}
   {if date('today', 'l')='Monday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]
{elseif date('today', 'l')='Tuesday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]     
     {elseif date('today', 'l')='Wednesday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]     
     {elseif date('today', 'l')='Thursday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]     
{elseif date('today', 'l')='Friday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]          
{elseif date('today', 'l')='Saturday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]          
{elseif date('today', 'l')='Sunday'}  
     [link][show-image style="border: 5px solid yellow;"][/link]          
     
      {else}
     [link][show-image][/link]
 {/if}   
 </div> 
 {/articles}
Vinny Hebert's Avatar Vinny Hebert
Perhaps I should isolate each day of the week with it's own {article} tag instead of trying to do a loop.
Vinny Hebert's Avatar Vinny Hebert
Yep, that seemed to produce the results I was looking for. Thank you for just allowing me to talk about it. You confirmed that I was heading in the right direction.
Vinny Hebert's Avatar Vinny Hebert
Oh, and in your documention at Filters:Advanced->Relative Dates The link in this line: See the full list of the possible Relative Date Values that can be used. comes back with a 404 error.
Peter van Westen's Avatar Peter van Westen ADMIN
👍
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription