Search
Other Conditional Content questions
Forum

Condition by week numbers

Greg's Avatar Greg
Hello,

Is it possible to play with the conditions per week?

Example for a restaurant that makes menus per week.

Thank you and a very good year 2023
Peter van Westen's Avatar Peter van Westen ADMIN
Yes, you can use the PHP condition rule for this.
See: docs4.regularlabs.com/advancedmodulemana...ustom-php-conditions

Do something like:
$week_number = 6;
return date('W') == $week_number;
See here for more on the PHP date function:
www.php.net/manual/en/datetime.format.php
Please post a rating at the Joomla! Extensions Directory
Greg's Avatar Greg
Oh thank you so much! It's perfect!
Greg's Avatar Greg
Hello,

I would like to use several weeks, but I can't get my code to work.

Is it possible?

Thank you for your help!
$week_numbers = array(8, 9, 20);
$current_week_number = date('W');
if (in_array($current_week_number, $week_numbers)) {
return date('W') == $week_numbers;
}
else {
}
Peter van Westen's Avatar Peter van Westen ADMIN
$week_numbers = array(8, 9, 20);
$current_week_number = date('W');

return in_array($current_week_number, $week_numbers);
Please post a rating at the Joomla! Extensions Directory
Greg's Avatar Greg
Wonderful! Thank you very much!
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription