Advertisement

How to Show date using PHP Strftime

How to Show date using PHP Strftime

In this tutorial, I am going to tell you how to show current date using PHP builtin function strftime();
It is very easy, you just need to pass some parameters to this function, which format the date.
In this tutorial, I will teach you how to show date in this format : Day, date month, Year.
For Example:

Thursday, 19 June , 2008

Well, as I said above, it is really easy.
You just put this PHP snippet on the page where you want the date to be shown:

PHP Code:
<?php
$date = strftime("%A, %d %B, %Y");
?>

And then, where ever you want to show the date, you just write this little text :

PHP Code:
<?php
echo $date;
?>

And thats it guys, pretty easy, isnt it?



Highlight Current Active Navigation Link - Step 2 - PHP

Highlight Current Active Navigation Menu Link using PHP Xhtml and CSS

Now that our Page is ready, we need to integrate our menu in that page.

Step 2: PHP

To do this, open the home.php again, and at the top of the page, before anything, add this PHP code:
PHP Code :
Read the rest of this entry »



Highlight Current Active Navigation Link - Step 1 - Xhtml and Css

Highlight Current Active Navigation Menu Link using PHP Xhtml and CSS

Today I am going to teach you how to make Dynamic Navigation bar or Highlight the Currently Active Link in your Navigation menu or anywhere in your page, like the ones being used on our site.
This can easily be done using PHP, CSS and HTML / XHTML.
Read the rest of this entry »



How to remove write protection from USB drive

How to remove write protection from a write protected USB flash drive:

Six days ago, My Kingston USB Flash Drive got Write Protected, And I couldnt write files to it, nor could I delete any files, nor could I format my USB drive.
I spent hours and hours searching on google for a solution, then on a forum, I finnally found a guide that worked for me :D (Hurray !)
Well, this guide includes edits in windows registry, but its very easy.
Here is the guide :
Read the rest of this entry »



Display current time using PHP

Display time using PHP


Today, I will tell you how to display current time in this format : HH:MM:SS ( Hours:Minutes:Seconds )
We will use PHP’s Built in Function : time(); and another one : date(); in a combination to set our time according to our Time Zone.
The most easiest example is :
Read the rest of this entry »



PHP if else and if elseif else statement

Okay now back to basics.
Many of new php programmers dont even know the uses of PHP’s If else and elseif Statement.
So, I thought it would be good to teach them..

We are going to use the built in PHP function rand() to get results of flipping a coin.
Then we will use PHP if else statement to check if the result is equal to 1.
These are pretty self explainary, if something is true, then execute some, else (if it isnt true) then execute something else.
Read the rest of this entry »



Make the Footer Stick to the Bottom of a Page

Make the Footer Stick to the Bottom of a Page

Browsers
Many of us dont know how to make the sticky footer at the bottom of page using CSS stylesheet.
Now is the time to learn it !

There are several ways to make a footer stick to the bottom of a page using CSS which works on all the major browsers; Internet Explorer 5 and up, Firefox, Safari, Opera and others.

How to use this footer on your website

Add the following lines of CSS to your stylesheet. The negative value for the margin in #wrapper is the same number as the height of #footer and .push. The negative margin should always equal to the full height of the footer (including any padding or borders you may add).
Read the rest of this entry »



How to Download files using Cron Jobs - cURL

Download files using Cron Jobs - cURL

In this tutorial, I am gonna teach you , how to download files using Cpanel’s Cron Jobs with the help of cULR .
Downloading files to your Server using cURL is pretty easy if you have access to Cron Jobs or SSH Shell.
It saves a lot of time if you use this method to upload files instead of downloading file to your PC and uploading it again to your server.
Suppose you have a slow dialup connection, and you want to install Latest Wordpress to your server, you will need to Download it to your own PC then upload to your Server again, it will be a waste of time, Let me show you an easier way, that will save your time and energy.
Read the rest of this entry »



How to Access your PC using a Subdomain

Okay, Today I am going to teach you how to access your PC using a Subdomain, instead of a Hard-to-remember IP address.

Its easy, lets get started !

First goto http://www.pegor.com/your-ip-address/
Copy your IP address, which is shown on the middle of Page.
Now goto http://www.no-ip.com/ and register an account, Then login after activation and every thing.
Click on Hosts / Redirects tab on left side, it will expand.
Then under the Hosts / Redirects section click Add
In Hostname field, type anything you want, like BilalGhouri or MyInernationallyLocalWebsite etc and select a Subdomain.
Choose DNS host(a) as the Host Type.
In IP Address field, type your IP Address which you copied earlier from http://www.pegor.com/your-ip-address/.
Scroll down to the bottom of page and click on Create Host button.

Now we are almost done, but if you have a dynamic IP Address, it will change everytime you reconnect to internet, for this, we will need a Dynamic DNS update Client to update our Subdomain to our current IP Address.

Now goto their Download section choose your operating system.
Download their DNS Update Client.
Install the DNS Update Client. and enter your Login information (same as website’s)
Wait for it to Login Successfully…
After Logging in, Your Subdomains will be displayed on the main window of the DNS Update Client. If its not there, Refresh the Host List window.
Put a check on your Subdomain, If it is already checked then put the check off and again put the check on it.
This will re-update our Subdomain to our current IP Address.
Now you can close the Client.
So now, After everything, You can finally Access your Local Site from anywhere by using this URL: http://YourIPAddress or http://host-you-chose.subdomain-you-chose.com
Just Remember to Update your Subdomain’s IP Address VIA DNS Update Client everytime you reconnect to Internet.

Thats all folks !
Easy, isnt it??



Misc Tutorials

Misc Tutorials contains large collection of tutorials, tips and tricks on various other subjects like Games, Technology, Gadgets etc. Submit a Tutorial