PDA

View Full Version : Different page content based on day of the week in PHP



AlexY
November 30th, 2010, 08:29 PM
If you would like to create a script that would display different content based on what day it is it can be easily done in PHP with a script like below:


<?php
if( date( 'w' ) == 0 ) {
?>
<div>Write what you need to show here on Sunday</div>
<?
}
if( date( 'w' ) == 1 ) {
?>
<div>Write what you need to show here on Monday</div>
<?
}
?>
<?
if( date( 'w' ) == 2 ) {
?>
<div>Write what you need to show here on Tuesday</div>
<?
}
?>
<?
if( date( 'w' ) == 3 ) {
?>
<div>Write what you need to show here on Wednesday</div>
<?
}
?>
<?
if( date( 'w' ) == 4 ) {
?>
<div>Write what you need to show here on Thursday</div>
<?
}
?>
<?
if( date( 'w' ) == 5 ) {
?>
<div>Write what you need to show here on Friday</div>
<?
}
?>
<?
if( date( 'w' ) == 6 ) {
?>
<div>Write what you need to show here on Saturday</div>
<?
}
?>