Is there a way to use the If conditionals to test for days of the week...?
Conditional testing for day of week...
Collapse
X
-
-
Date functions don't work in conditionals, so you would need to use code like this in your phpinclude_start template:
Code:$dayofweek = vbdate('D', TIMENOW);
Code:<if condition="$dayofweek == 'Mon'"> THIS CODE WILL ONLY DISPLAY ON MONDAYS </if>
-
-
Hi Jake
I am trying to test for days in an array and I am not able to get the code working correctly. This is the conditional I have been trying;
HTML Code:<if condition="in_array($dayofweek, array('Mon','Tues'))"> THIS CODE is from the array </if>
TaComment
-
That looks correct to me. Which template is this in?
Also, the days of the week are given in 3 letter abbreviations. Refer to this page:
Comment
-
I didn't actually get this to work Jake, but I think that was because I was running the conditional in level1_nopost whilst checking for the sub-forums... which of course wouldn't have found anything. I should have been checking for the forumID of the category containing the forumID's... (if that makes sense)
I am developing a new template though and will try it out in there. Thanks for the reply.Comment
-
-
Originally posted by TheMusicManI didn't actually get this to work Jake, but I think that was because I was running the conditional in level1_nopost whilst checking for the sub-forums... which of course wouldn't have found anything. I should have been checking for the forumID of the category containing the forumID's... (if that makes sense)
I am developing a new template though and will try it out in there. Thanks for the reply.
Code:$GLOBALS[dayofweek]
Comment
Related Topics
Collapse
-
I have the code. I just do not where to paste it.
-
Channel: Support Issues & Questions
Fri 16 Jun '17, 10:30am -
Comment