GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Php question (https://gfy.com/showthread.php?t=956542)

teh ghey 03-02-2010 06:58 PM

Php question
 
I have this If statement
<!-- IF active_module == "homepage" -->
show image here
<!-- ENDIF -->
I only want to use this IF statement on monday - thursday.

on friday-sunday I do not want to use the IF statement, so it just shows the image on every page, not just the homepage.

How can I make it so that the IF statement only runs monday through thursday, and on friday-sunday it doesnt use the IF?

sarettah 03-02-2010 07:30 PM

Quote:

Originally Posted by teh ghey (Post 16915183)
I have this If statement
<!-- IF active_module == "homepage" -->
show image here
<!-- ENDIF -->
I only want to use this IF statement on monday - thursday.

on friday-sunday I do not want to use the IF statement, so it just shows the image on every page, not just the homepage.

How can I make it so that the IF statement only runs monday through thursday, and on friday-sunday it doesnt use the IF?

if date('w',time())>=1 && date('w',time())<=4 && .................

That will check if the day of the week is between Monday (1) and Thursday (4)

teh ghey 03-02-2010 07:35 PM

thank you!
I know zero about php, do I have to put a <?php> in front of it?
im fixing a template i bought

sarettah 03-02-2010 07:44 PM

<?php if(date('w',time())>=1 && date('w',time())<=4) {?>

Your template code here

<?php } ?>

should work.

Let me know how it goes

teh ghey 03-02-2010 07:47 PM

It worked!!!!
you rock, thank you so much!!!

sarettah 03-02-2010 07:51 PM

Quote:

Originally Posted by teh ghey (Post 16915243)
It worked!!!!
you rock, thank you so much!!!

np.......

quantum-x 03-02-2010 08:13 PM

Quote:

Originally Posted by sarettah (Post 16915240)
<?php if(date('w',time())>=1 && date('w',time())<=4) {?>

Your template code here

<?php } ?>

should work.

Let me know how it goes

Why not just

<? if(date('w')>=1 && date('w')<=4) {?>

time() is redundant

sarettah 03-02-2010 09:06 PM

Quote:

Originally Posted by quantum-x (Post 16915283)
Why not just

<? if(date('w')>=1 && date('w')<=4) {?>

time() is redundant

Because I am redundant I guess. I usually use the date() function with something other than the current time so I forget that it defaults to using the current time if you leave the param out.

Dangers of answering off the top of my head while I am breaking from code.


All times are GMT -7. The time now is 08:59 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123