1
Acertijo
Block for specific day
  • 2013/1/11 20:34

  • Acertijo

  • Just popping in

  • Posts: 2

  • Since: 2011/3/10


hi friends, is there a module or code that i can show a block in a specific date? i need to show a block only on Fridays but i canĀ“t find anything,
any idea?

2
Mamba
Re: Block for specific day
  • 2013/1/11 22:37

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


You probably would have to use a cron job to do it, but I don't know how could we incorporate it into XOOPS.

Thinking here just loud - maybe you could have a block reading a content from a file, if one exist. And the cron job would rename a file on Thursday midnight to the correct name, and on Friday midnight rename to something else. If XOOPS doesn't see the file, it will be an empty block.

But this is just a thought. Maybe some of the gurus could come up with a more realistic suggestion
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
zyspec
Re: Block for specific day
  • 2013/1/12 0:22

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


You can just use the PHP date() function to find the day of the week and then either 'return' or display based on the day of week. For example:

if (== $date('w')) {
  
//display Friday's info
  
echo "It's Friday!";
}

4
trabis
Re: Block for specific day
  • 2013/1/12 1:06

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

zyspec wrote:
You can just use the PHP date() function to find the day of the week and then either 'return' or display based on the day of week. For example:

if (== $date('w')) {
  
//display Friday's info
  
echo "It's Friday!";
}


And if the block already exists in a module, you can edit the block function.
Example for system_blocks.php
function b_system_online_show()
{
if (
!= date('w')) {
  
//if it is not Friday don't display the block
  
return false;
}
//Display code here
}

5
Mamba
Re: Block for specific day
  • 2013/1/12 2:56

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


I knew, I can count on the gurus!

Thanks Zyspec and Trabis!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

6
sabahan
Re: Block for specific day
  • 2013/1/12 4:28

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 5


trabis,

do the time based block feature in mytabs module can do this ? tried it before but never got it working..

7
trabis
Re: Block for specific day
  • 2013/1/12 13:32

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


@sabahan
As far a I remember, Mytabs only allows one range of time, you would have to set the range every week :(

8
Acertijo
Re: Block for specific day
  • 2013/1/12 14:02

  • Acertijo

  • Just popping in

  • Posts: 2

  • Since: 2011/3/10


thanks to all, i will try and comment the results :)

Login

Who's Online

249 user(s) are online (176 user(s) are browsing Support Forums)


Members: 0


Guests: 249


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits