Home > Computers > PHP Script: Changing Background Based on the Day
PHP Script: Changing Background Based on the Day
PHP script that will be discussed this time used to change the background of our web pages according to day. For example on Monday, we want the background color Yellow, Tuesday, Red, and so on. Interested? Please continue reading.
Actually a simple principle. We will use branching statements or if else to do it.
The logic is like this. PHP script we'll find out the name today by using date functions (see the example of another script that uses this function when calculating the time and calendar calculations). Well, then today's name will be matched using the command menampilkanwarna if else and then we want according to the results of matching the name of the day.
The full PHP script is like this:
$today = date("l");
print("$today");
if($today == "Sunday")
{
$bgcolor = "#FEF0C5";
}
elseif($today == "Monday")
{
$bgcolor = "#FFFFFF";
}
elseif($today == "Tuesday")
{
$bgcolor = "#FBFFC4";
}
elseif($today == "Wednesday")
{
$bgcolor = "#FFE0DD";
}
elseif($today == "Thursday")
{
$bgcolor = "#E6EDFF";
}
elseif($today == "Friday")
{
$bgcolor = "#E9FFE6";
}
else
{
// hari terakhir tentusaja hari Sabtu (Saturday) kan?
$bgcolor = "#F0F4F1";
}
print("\n");
?>
This script just change the background color, you can customize your own contents
Hopefully useful.
Warmest regards.
Related Post
Computers
- Make Music With Linux
- About Linux
- how to install vmware on backtrack
- Protecting Your Computer from Hackers and Spyware with ZoneAlarm Free Firewall 2012
- Running Linux from USB Stick on the Windows computer with a Linux Live USB Creator
- HISTORY AND THE TYPES OF LINUX DISTRO
- Port Scanning with Nmap
- How to learn Linux quickly and easily
- 10 Handy Windows 7 Gadgets
- # develop, Alternative Instrument-Based Application Development. NET Framework
- Kids and technology: The new rules of online safety
- LFI Apache Log Poisoning
- WordPress TimThumb Exploitation
Category Article Computers
Powered by Blogger.
Popular Posts
-
A quick question with a long answer. Actually there is nothing difficult in Linux if you already understand the basics of operating a compu...
-
Gadgets that are made for Windows 7 are portals for inclusion of many of the additional features that can make your Windows 7 work in the wa...
-
Shown with clear and certainly big enough for the size of a cellphone, the Samsung S2 Galaxy is very nice to use browsing, sms's and of...
-
Touch screen allows you to access features including mobile applications and navigate more easily and intuitively. Screen QWERTY is so ideal...
-
GENERAL Network GSM 850 / 900 / 1800 / 1900 HSDPA 850 / 900 / 1900 / 2100 Announced 2011, 1Q Processor 1 GHz dual-core processor SAR R...
-
LINUX HISTORY History of the Linux operating system is closely related to the GNU project, project free freeware program known chaired by...