May 2012

May 21, 2012

New FREE PHP video tutorial of the week

How and why to create a simple custom function - 3:09

So far we've looked at a number of built-in functions for PHP, but this week we're going to start writing our own! Functions are a great way to create reusable code snippets, and as we'll see in upcoming videos, they also give us some flexibility in how the code gets executed.

New PHP videos on creating custom functions

This week we start digging into creating our own custom functions. Functions give us the freedom to execute code snippets wherever we need to without copying and pasting existing code. Logically, functions help us organize functionality into reasonable pieces that will help us understand our code later, or will help other team members get a sense of what certain code is for. From this point forward, functions will form a large part of how we structure our code, so it's good to make sure you have a solid grasp of what's going on.

How to create a function that accepts parameters - 1:35

Now that you know how to create a function, we'll look at how to pass data to it in the form of a parameter. Parameters are just variables we can use within our functions, but being able to use them packs a lot of power when it comes to writing code.

How to create a function that has optional parameters and build a virtual dice roller - 4:05

In this video we walk through creating a classic dice roller application using a custom function. We also explore the idea of optional parameters to allow flexibility but simplify code when possible.

A deeper explanation of the purpose of custom functions - 1:46

In this brief video, we explain how custom functions can evolve and become more powerful than using loops or copying and pasting code to get the same logic to run.

How to work with references in a function (i.e. variables with an ampersand) - 4:14

You'll probably run across references in Drupal's code before you actually have a need to use them yourself, so it's good to get a sense for what they do and how they work. References are basically variables that get passed into a function as a pointer to existing variable data. And if that doesn't make any sense, check out the video and it will soon!

May 8, 2012

Come see me speak (if you'd like)

On June 9th, I will be Keynoting at DrupalCamp Sacramento, California, after conducting a free Mentored Training on June 8. It sounds be a great event with a lot of awesome people.

And just in case you're in the Chicago area, this next Thursday (May 10th)I'll be speaking at the famous Chicagoan CMS Expo on Powering a Lean Startup With Drupal. If you have an idea you've been trying to get off the ground, this talk will be all about how to free up the time and build the resources you need to make it happen.

And of course, we have some new PHP videos rolling out this week on a fun and powerful subject:

5 new videos on looping in PHP

Last week we explored some basic control structures like 'if' and 'elseif'. This week, we keep building the logical tools you'll need to build powerful PHP-based applications by exploring looping. As we've alluded to in previous videos, whenever you find yourself repeating the same kind of code over and over again, you can probably save some space in your code - and some sanity later if you need to update the code - by using loops.

How to use a foreach loop to generate an HTML table from an array - 6:43

One common use of a loop is to generate HTML content based off of data in an array. In this video, we generate an HTML table (you'll do this at some point in your development life, I guarantee it!)

How to use a "while" loop - 4:37

Sometimes you need to run a loop a number of times, but not based off of an array. We explore the 'while' looping construct in this video, where we test against a particular condition to decide whether to continue or cut out.

How to use a "for" loop and how it compares to "while" - 1:00

The 'for' loop is pretty si mi liar to 'while', but is a little more compact (and maybe a little more challenging to read). In this video, you can take a gander at 'while' and 'for' side by side.

How to modify PHP settings with the php.ini file and stop runaway scripts - 2:36

Now that we're playing with loops, it's important to know how to stop one if we accidentally set one up to run forever (oops!). In this video we look at modifying some core PHP settings in the php.ini file, and what happens to those infinite loops if we do let them run wild for a while.

New FREE PHP video tutorial of the week

How to use a "foreach" loop - 3:36

A hugely powerful, but sometimes difficult-to-wrap-your-mind-around-concept is "looping." In this video, we look at one control structure called 'foreach', which will allow us to loop through each item in an array and run some code each time. We'll spend a bit of time on loops since they're so important to coding, but our journey starts here!

May 1, 2012

Get 20% off of all memberships!

This week only you can get 20% off of your initial purchase of a 1- 6- or 12-month membership. Just use the code GETITALL when checking out. Now's your chance to get access to over 650 perfectly paced Drupal training videos, 24 /7. (Note that membership renewals will revert back to the original amount).

New logical PHP videos

This week we begin looking at the logical side of PHP. Now that you're comfortable with strings and arrays, we can start programming PHP to accomplish tasks - which is really what logic is all about. In the first video we give you a sense of what we mean by 'logic', and then we dive right into something called 'control structures', which are PHP constructs that direct PHP in some way. Specifically, we explore how to tell PHP to run certain code only in certain conditions with 'if' and 'if...elseif' statements.

What logic is and how we're approaching learning it - 1:30

Before we jump into working logic, we take a birds-eye view of what logic actually is and how we're going to go about learning it. If you're new to coding in general, this will be a good one to watch.

How to use an "if ... elseif" control structure - 4:35

We can also extend an 'if' control structure to include other criteria, and in this video we explain how to do this with 'if...elseif'.

Incorporating what we know about arrays and control structures in a random generator script - 6:08

In this video we start applying what we've learned about control structures and working with arrays to create a fun random text generation script.

Adding additional elements of randomness to our random generator script - 5:51

Never one to leave good enough alone, in this video we make our random generation script even more fun and flexible by adding additional random elements to it.

New FREE PHP video tutorial of the week

How to use an "if" control structure - 3:32

In this video we walk through a commonly used control where we build code to tell PHP to make a choice based on certain criteria. We'll be using 'if' statements a lot in upcoming code, so getting a sense of the different parts of the structure will pay off down the road.