Archive for November, 2008

25 Nov 2008


Photoshop Tutorial: Vintage Photo

There has been a new tutorial added from Matt Lidlum. It is how to make a Vintage-style photo in Photoshop. Very neat technique.

19 Nov 2008


Reflection: A photoshop tutorial

There is a new Photoshop tutorial available on simple reflecting techniques. Most designers know that reflection and gradients are key factors to Web 2.0 design. Matt Lidlum goes through the basics of gradients, color, and the use of the Skew property to make great looking reflections effects on both text and photos.

18 Nov 2008


Link Bar: a Photoshop tutorial

Kasey has taken the time to proved a detailed video tutorial for Photoshop on creating a basic link bar. The finer details of web design are what make designs great. A professional, sleek navigation bar is a great addition to any website layout. Click the read more link to view the video.

17 Nov 2008


PHP for Beginners: Part II

This is a series of tutorials; here are the others:

This exercise assumes that you either have PHP installed on your computer already or that you have access to a server with PHP support.

Hail, reader! It is gratifying to find that you enjoyed (or at least survived) my first tutorial on the subject of PHP and preferred to continue with the course! I applaud this effort, as it is in the direction of one of the most useful and essential languages to a web developer in the Web 2.0 era.

But we shall hold the accolades until the end. For now, lets get a brief overview of what we’ll be digging into in Part II:

  • Variables and their uses
  • Data types
  • New functions
    • gettype()
    • var_dump()
    • settype()
  • Arithmetic operators
  • Quiz

Variables and their uses

Variables are the underlying dynamic ability of PHP. It’s what allows code to modify the input of a user to suit the purpose of the code’s author. Now, if you’ve taken anything higher than Algebra, you will find this section to be something of a breeze. For those who feel that a review would be beneficial, however, I’ve decided to include a crash course in variables and their operations.

Variables in PHP are much the same in nature as those in math: it is a number, sequence, or operator defined by a letter or a name, such as x or variable_1. In order to define a variable in PHP, you simply type the name of your variable and precede the name by a dollar sign, $. Following this, you will proceed to define the variable with an equal sign similar to below:

$name = "Matt Lidlum";

You will notice that the variable is now defined as Matt Lidlum, which is the argument of the function. The argument, if you’ll remember, is whatever is between either the parentheses or else the quotation marks. And as before, it is important to note that the variable is not defined as “Matt Lidlum”, but simply Matt Lidlum.

Names, however, are not the only things that you can put in here. Numbers can go in as well, as well as operators (which will be discussed later), and various other data types. For now, play around with variables and try using the print function we learned in Part I. An example script is below:

       <title>PHP for Beginners: Part II</title>
            $name = "Matt Lidlum";
            print "$name";
            // This function will print Matt Lidlum

Data types

Data types will again call on your mathematical skills in order for you to gain full comprehension. You will find a number of references to math class, so hopefully your motivation to learn PHP and other languages will be motivation enough to keep your head off that comfy sweatshirt.

Back to the matter at hand, there are a total of eight data types used within PHP: six standard and two special. To familiarize yourself with them, please glance over the following tables:

Standard Data Types

PHP Standard Data types

Special Data Types

PHP Special Data Types

As I’m sure you will notice, a number of these data types are already familiar to you. The print function that we discussed within Part I as well as our $name variable both used a string data type. We will not be stopping there, however. Later this lesson you will also touch base on the double, integer, boolean, and NULL data types as well within the functions section.

New functions

As a quick review, you will remember that last lesson we learnt the function print. Within the argument of the print function you could type anything that you would wish to be displayed on your web page. Moving on from this, we will be mastering three new functions, all of which are more used as diagnostic tools to find errors in the code.


We’ll start with the gettype() function. The gettype() function is used in conjunction with the variables within an author’s program. What this function does is display the variable type (string, integer, etc.) on your web page. Simply type the variable name, $ and all, and PHP will return the variable type to you, simple as that. Although this may seem trivial in terms of use, I assure you that it will be built upon later.


This function is similar to gettype() in its purpose: diagnostics. It does much the same thing, but in a different way. By placing a variable’s name within the argument, PHP will post the variable’s type as well as the variable’s value. Again, the purpose of this function will be built upon later.


Settype() is used to change the variable’s type. This function comes in handy when evaluating a user’s input. For example, let’s say that you have created a form based off of PHP and HTML that asks for a user’s input on the company’s customer service. From a drop-down menu, they may choose either good, bad, or impartial. Now, for instance, let’s say that the user chooses good. With settype we can rewrite that variable as true, a boolean data type as you may remember. Thus, in later parts of the code, the true value will initiate other code segments to execute. Another example is a rating system. In a similar question, suppose the user has the option of typing a number 1-5. Suppose now that they type a non-integer value such as 4.2. With settype, the author can automatically change that input to an integer by simply setting the new type of the variable from double to integer. Thus, 4.2 will round down to 4, giving the author exactly what they want. In order for this to be carried out, however, the author must complete the function in the following manner:

     settype ( $VAR_NAME , NEW_DATA_TYPE)

Now that you have three new functions to add to your print function, it’s time to give them all a shot. Try using variables and messing around with data types as well. Below is an example of PHP and HTML code that I drew up:

         <title>PHP for Beginners: Part II</title>
              $double = "4.5";
              $integer = "6";
              $name = "Matt Lidlum"; //Three separate variables
              print "$name" //Matt Lidlum
              gettype ($integer) //Integer
              gettype ($name) //String
              settype ($double, int) //$double is now an integer
              print "$double" //5

Arithmetic Operators

Okay, I know this is getting long and a lot is being thrown at you, but hang in there. What the following discusses is operators; the little things that allow you to manipulate data such as variables or input. Below is a table of arithmetic operators. There are a number of other operators within PHP that are used to do such things as compare data, but we will focus on those in a later tutorial:


I’m sure you are heaving a huge sigh of relief because as you can tell, these are very simple operators. Simple operators, however, that can have a significant effect on a piece of code. We’ll start off nice and easy with operators. First, lets try them with the print function:

     print "4 + 5"; //9

Nothing to it, right? This is, as the section is titled, simple arithmetic. Now lets try it out with variables and even changing the variable’s value.

     $x = "8";
     $x = "$x + 4"; //$x now equals 12
     $y = "2 * $x"; //$y now equals 24
     $z = "$y - $x"; //$z now equals 12
     print "$y - $x is equal to $z!"; //Math is fun!

Here, I defined $x, modified it by adding 4, then defined $y as 2 * $x, and finally made $z equal to $y – $x. Play around with these operators, mixing the print or any other new function among it.


Exams help you to retain knowledge that you have just gained, so with that in mind, I’m afraid it’s back to the classroom for everyone. I urge you to not look back at the material or peek ahead at the answer key.

#1: Using the gettype() function on $x when $x = “4.3″ will return…

A.) Boolean
B.) Integer
C.) Double

#2: Using $x from Question 1, using the settype() function on $x, changing it to Integer, will return the value…

A.) True
B.) $x
C.) 4

#3: Which of the following is not an arithmetic operator?

A.) %
B.) &
C.) *

#4: The data type NULL is present when a variable…

A.) Has not been used in a function
B.) Has not been initiated (defined)
C.) Is placed in the gettype() function

#5: Variables are always preceded by…

A.) $
B.) &
C.) %

Answer key: C,C,B,B,A


Well everyone, this tutorial must now come to a close! We’ve made some great strides in part two, and I hope that you’ll stick around for the next article, PHP for Beginners: Part III.

16 Nov 2008


PHP For Beginners: Part I

This exercise assumes that you either have PHP installed on your computer already or that you have access to a server with PHP support.

Greetings, eager student! What you are looking at is the first of many tutorials that combine to create an extended resource for PHP beginners. PHP is a staple language within the web design community crucial to the portfolio of any designer. This tutorial and the following series will allow you to read, interpret, modify, and create with PHP, one of the most versatile languages on the net.

Now that we have an idea of what you’re getting into, let’s get a quick overview of what we’ll cover in this tutorial:

  • Identifying PHP tags
  • Writing your first PHP script
  • Combining PHP with HTML
  • Comments within PHP code
  • Quiz

Identifying PHP tags

Web designers have no shortage of languages to use in their work. With CSS, Python, PHP, HTML, and Java crowding the internet with potential, it’s important for the page to know to execute a specific segment of code within a certain language. That’s what tags are for.

If you look in the Source of any web site you’ll see a number of tags. One example is <head>, which is an opening tag used within the HTML language. When the server reads this tag, it knows to execute the following code within the HTML language until it sees the closing tag, which in this case is </head>. The tags used within PHP are very similar to these, and they serve the exact same purpose.

Listed below are these mentioned tags. Look carefully, as they are your first step into the world of PHP programming:

PHP Tags

Pretty basic, right? They all pretty much do the same thing, however your PHP installation will most likely only have the Standard, Short, and Script tags enabled. That’s okay, because Short and Standard are really the only ones that we will be using. Even after you have completed the tutorial, you will see very little deviation from this choice of style.

Writing your first PHP script

Okay, that’s enough background, how about we actually get down to some coding? The script I’m going to introduce you to is called the “Hello world” script. This script has become rather famous as it is almost always the first script given to students when they learn a new language. What we intend to do within this script is simply print the words “Hello world” on your web page. This will be done using the print function.

The print function is exactly what it sounds like: whatever is within the function’s argument, which is whatever is typed after the function, will be printed on the screen for your viewer. See? It doesn’t get much simpler than that. Now that we understand the function, I’m going to give you the piece of code that we will be analyzing. This is because I always have found it easier to understand a language by viewing it and interpreting the coding. So, without further ado, here is the “Hello world” script for PHP:

     echo "Hello World!";

As I’m sure you will notice first, we have used the tags that I referred to in the previous section. I decided to go with the Standard tags so that you would immediately recognize them for what they are. Next, I’m sure you will notice the print function, and following this the function’s argument. What you might not notice, however, are the apostrophes surrounding Hello world. The reason we are doing this is to specify the function’s argument. Without these apostrophes, the print function would try and display the closing tag ?> instead of simply ending with “world”.

So now that you have this script, I want you to do the following, step-by-step, and you will have successfully made your first code.

  1. Copy and paste the above code into Notepad or another web editor such as FrontPage or Dreamweaver.
  2. Save the file as “NAME_HERE.php”. If in Notepad, make sure you are not saving it as “NAME_HERE.php.txt”.
  3. Upload your file to your server (make sure it supports PHP)
  4. Visit the page, and voila! Congratulations!

Now that you have completed the “Hello world” script, try playing around with the script: modify the print argument, change the tags, or try adding another print function and typing some more.

PHP and HTML are very harmonious, meaning that they work well with each other and allow one other to reach new heights. To integrate PHP into HTML is a very simple process. Pretty much all you have to do is copy and paste! Observe below a simple HTML page with our “Hello world” script embedded within.

      <title>PHP for Beginners: Part I</title>
           print “Hello world”;

That’s all there is to it! Explore how this works with your alternate scripts that you created from the previous section.

Comments within PHP Code

Comments are a helpful utility for both the new and professional programmer: they allow the author to write in notes to either themselves or to those who will ultimately use the script in order to assist in the script’s overall interpretation. Whatever is typed within an argument will not be read or executed by the server, making it completely irrelevant to the script’s operation. Below are a few values used to designate the beginning of a comment within the PHP language:

Comments in PHP

Referring back to our PHP and HTML script from the previous section, I decided to add in some helpful comments to you, the reader, so that you can better understand the code:

      <title>PHP for Beginners: Part I</title>
           print “Hello world”;
           // This function will print Hello world

           print “Hello PHP programmer”;
           # This function will print Hello PHP programmer

           /* None of these comments will be seen by the viewer
           unless they look at the source code for the web page*/

Try this concept on your own with your own script. Remember, however, that although comments cannot be seen on the page, they are still visible to the clever user. They simply have to view the page source and they will see the layout of your code, comments included. With that in mind, consider this your warning against doing such things as storing passwords or usernames within these comments, as they will become public knowledge very quickly.


Exams help you to retain knowledge that you have just gained, so with that in mind, I’m afraid it’s back to the classroom for everyone. I urge you to not look back at the material or peek ahead at the answer key.

#1: The print function will…

A.) Display text within the argument
B.) Command the computer to print the viewed document
C.) Not be recognized within the PHP language

#2: The argument of the print function is…

A.) The preceding text to the function
B.) All text following the function
C.) The text following the function within the apostrophes

#3: Comments can…

A.) Be seen only by the code author
B.) Be seen only by the page viewer
C.) Be seen by both parties

#4: Which of the following is not a correct PHP tag?

A.) <?php
B.) <%
C.) <php
D.) <?

#5: Which of the following is not a correct comment tag?

A.) */Comment here/*
B.) //Comment here
C.) #Comment here

Answer key: A,C,C,C,A


Well everyone, that’s it for now! We’ve laid some solid foundation from which to work off of. So with that in mind, keep practicing, good luck, and read on: