Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Display module in a few weeks numbered

Display module in a few weeks numbered

How do I show a module in specific week number?
Ex. 1,7,17,29,30,31,42,52 holidays at week by means of the array.
In other weeks desired another module shown.

I know I can do it this way:
$week_number = date("W"); // ISO-8601 week number, starting from 0
if ($week_number == 7) return 123;
if ($week_number == 42) return 125;

But can I do it by arrys
eg. if ($week_number == 7,8,12,29.30) return 123;

stovring
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Display module in a few weeks numbered

Hi stovring, that's a good question.

In PHP there are often lots of different ways of achieving the same thing. Here's one way:

Code:

$week_number = date("W"); // ISO-8601 week number, starting from 0 

if ($week_number == 42) return 125;
if ( in_array( $week_number, array( 7,8,12,29,30 ))) return 123;

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5912
Total Posts Today:
4
User Info:
 
Total Users:
11504
Newest User:
toko solo
Members Online:
0
Guests Online:
80

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked