Community Poll

Published on Jan 28, 2009   //  Polls
Off

Weekly Community Poll

Last week we asked does your 2009 marketing plan include Social Media and 88% said yes. If you do not have it in your marketing plan maybe you should reconsider. This weeks question is…

 

{democracy:66}

UBC – The Write Stuff

Published on Jan 28, 2009   //  Events

Do you feel you lack the writing skills to blog or write content for your site?

This course is a great way to learn the following…

  • Find a natural, effective writing voice for every situation
  • Gain control of your message with clear, concise language
  • Cut down on writing time
  • Reduce grammatical errors and punctuate with greater confidence
  • Use writing to sharpen your thinking process
  • Structure letters, memos and e-mail for maximum effectiveness
  • Generate and organize ideas more effectively
  • Enhance your productivity and performance
  • Improve accountability and help develop other people
  • Motivate others and make the best possible impression through writing

When is the course happening?
Thursday, February 5, 2009 9:00 AM - Friday February 6, 2009 4:00 PM

Where is it happening?
Robson Square – 800 Robson St  - Vancouver

Registration
You can view more details and register online for this course.

Course Fee
This course costs $1095.00.

WordPress Wednesday: Referrer Detector

Published on Jan 28, 2009   //  WordPress
Off

Traffic to your blog can come from a variety of sources. You’ve got people searching for things on Google, people reading interesting stories on Digg, and people sharing their thoughts on Twitter. Depending on the path that people take to get to your blog, you may feel inclined to treat them a certain way. This is about targeting and reader retention.

A great WordPress plug-in that addresses this very concern is Referrer Detector. As its name implies, the plug-in is able to detect the source of the current visitor. So, what advantage does this have over other web analytics data? Well, Referrer Detector is actually able to use this data to provide a custom greeting.

For example, if a visitor comes from Digg.com, the greeting at the top of the post could be to remind them to Digg the post. If a visitor is referred by Twitter, the greeting can ask them to retweet the link to the post. It’s totally up to you how you want to use this and the custom greeting, which you can compose yourself, can be placed either at the top or the bottom of a post. The custom greeting can contain WordPress attributes too, like the particular URL or post title.

For more information and to download Referrer Detector, check out the official page at WeblogToolsCollection.com.

Bandwidth Overload Sale

Published on Jan 28, 2009   //  News Worthy
Off

Data Center

To kick off the new year we are pushing out our Bandwidth Overload Sale.

Purchase a server in the next 72 hours and get a free Unmetered 10Mbps port. This means that you will not be capped by a monthly bandwidth limit.

These plans are good for anyone that is running a streaming radio station or have a high bandwidth site.

This sale may never happen again so take advantage of it while you can. After 72 hours all our plans go back to normal. So act now!

Everything PHP: Functions

Published on Jan 27, 2009   //  Development
Off

Everything PHP

This week we’ll be talking about PHP functions. We’ll talk about PHP’s built-in functions and how to create your own.

Buillt-in Functions

PHP has thousands of built-in functions for you to use. You may have already caught onto how to use this, but I’ll explain it anyways. Almost all (if not all) of PHP functions return their result back to you. Off the top of my head, I can’t think of any that will echo their result. There are two types of functions, ones that take no parameters and those that take parameters and somehow compute them into their result. Let’s first look at functions that do not take any parameters:

[code='php']echo time();[/code]

time() is a function that will return the current Unix timestamp. It accepts no parameters. Functions are called by using the function name followed by parentheses in your code. Since most functions will not echo their result, you will use them in variables, constructs or other functions.

Now, let’s look at a function that accepts parameters. Parameters go between the parentheses and should be separated by a comma if you are passing multiple arguments to it.

[code='php']echo date('l');[/code]

Which would output the current day. The date() accepts two parameters, only one of which is necessary.

Custom Functions

There will come a point when you’re programming a large project and will need to utilize the same piece of code over and over again through your project. This is the perfect time to create your own function. Making your own function is fairly simple, and again there are two type, ones with parameters and ones without. We’ll first look at one that doesn’t accept any parameters.

[code='php']function output_copyright() {
$current_year = date('Y');
echo 'Copyright ' . $current_year . ' The Company. All Rights Reserved.';
}[/code]

This function, when called, would echo Copyright 2009 The Company. All Rights Reserved. with the current year.

To create your own function, you need to precede the unique name of your function (it must be unique, and remember function naming rules) by the word function and a space. You then add you parentheses after the function name, and then a block of curly brackets. What you want your function to do should go within these curly brackets. Your function should always either echo or return something (even if it’s just TRUE or FALSE). Once you have created your function, you can only use it within the same document (either above or below the function declaration, it doesn’t matter), unless you include it into another document.

Now, let’s look at a function that accepts some parameters.

[code='php']function output_copyright2( $company, $start_year = NULL ) {
$current_year = date('Y');
if ( !is_null($start_year) ) {
$start_year = $start_year . '-';
}
echo 'Copyright ' . $start_year . $current_year . ' ' . $company . '. All Rights Reserved';
}[/code]

So, if you then called:

[code='php']output_copyright2( 'The Company', '1992' ) ;[/code]

The function would echo Copyright 1992-2009 The Company. All Rights Reserved.. Custom functions that accept parameters are very similar to one that do not accept parameters. The difference is, you put variables within the functions parentheses which act as the parameters you will be accepting within your function. Multiple parameters should be separated with commas, and the order of the parameters will need to be the order you give the parameters to when you’re calling the function. The variables you set in these parentheses will then be the variables you use to get at the provided parameters inside your function. You can also set default values for the parameters by appending an equal sign followed by the default value. However, the parameters with default values must go after the parameters without defaults.

Conclusion

As you can see, custom functions can be very useful. Large PHP projects often end up having hundreds (sometimes thousands) of custom functions to help prevent redundant code. Because we have now gone over functions, you should begin to take a look at the online PHP manual. This manual includes a function reference of all the built-in PHP functions available (as well as some available from extensions). You will end up using the manual all the time while programming with PHP, so you can lookup functions and what parameters they accept, as well as just learn more about PHP.

Web Dev: Meet CSS

Published on Jan 27, 2009   //  Development
Off

Web Development

This week we’ll be going over Cascading Style Sheets (CSS). Whereas XHTML is about the structure of a page, CSS is about the presentation of that structure. In the HTML days, the style and structure were all contained within HTML, which resulted in messy documents and inefficiencies in making style changes. XHTML and CSS allow us to separate style from structure, creating clean, and easy to edit, documents.

CSS can be used to change colours, font, positioning and various other properties of elements with your structure. Elements can either be a type of tag, or a specific tag identified using an id of class.

CSS’ syntax is fairly simple. It is made up of rules within declaration blocks. Let’s look at a basic XHTML document, then some CSS styling for it:

[code='xml']


Advanced XHTML Document

This is an example of an XHTML Document.

Image of Garmin GPS Device


[/code]

(Notice how we’re including the stylesheet in the head of the document using the style tag.)

[code='css']body {
background-color: gray;
}[/code]

The above CSS (which would go in a file called style.css) would turn the colour of the background of the XHTML document to gray. This is an example of a declaration block that affects a general tag, instead of a specific element. Notice the syntax, the name of the tag or element precedes rules encased in curly brackets. Rules are made up of a property name, followed by a colon, the value you want and then a semi-colon.

Note: CSS using the US English versions of words. So, in CSS you should use color and not colour, etc.

Now, let’s look at a declaration block that targets a specific element.

[code='css']#left {
color: white;
}[/code]

Which would make the text within the element that has the id of “left” white.\\

You should give a tag an id if you only plan on using that ID once throughout the entire document. If you want to use the same style more than once in a document, you should give those tags a class. In CSS, an ID is preceded by a number sign (# – also known as a hash or pound sign) and a class is preceded by a period.

While we’re talking about CSS colours, I should mention which ways you can specify them. You can use common colour names (aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white or yellow – as defined by the W3C), hexidecimal codes (eg. #0099CC) or RGB values in the form of rgb(255,255,255). Hexidecimal codes are the most commonly used.

Next week

There’s are literally hundreds of different CSS properties available, so we won’t be able to go over them all. However, next week we’ll go over some layout related properties.

Page 2 of 1312345...10...Last »