Posts Tagged ‘tutorial’

How to check to see if there are pages or posts before displaying in WordPress

When I’m programming a new theme in WordPress I’ll often want to check to see if there are going to be any results before I write content to the page, but often the process of calling the results will display it.

For example, if I want to list a series of pages inside a <ul> tag I first want to know if there is going to be a list of pages to write otherwise I will be writing an opening and closing <ul></ul> with nothing in the middle or worse, a title as well. To avoid this, here’s what I do:

[source lang="php"]<?

$list = wp_list_pages(‘echo=0′);

if ($list) {
echo "<h2>My pages</h2>";
echo "<ul>";
echo $list
echo "</ul>";
}

?>[/source]

The code example above simply uses the echo=0 option to preload the page list results into a variable called $list, next I simple check if $list has a value and if it does, I write the header and <ul> tags as well as the variable $list. If there are no pages, nothing is written.

 

I’ve build a similar function into three recent plugins, where you can preload the results into a variable using a show attribute by setting the value to false:

  1. $list = scheduledPosts(’show=false’);
  2. $list = randomPosts(’show=false’);
  3. $list = popularPosts(’show=false’);

Five simple things I did to increase traffic to my website.

When I started thisismyurl.com I didn’t have a loyal base of visitors, in fact I barely had a trickle of traffic. For the first month, I only received a couple visitors each day but now, five months after launching my website I receive a few hundred unique visitors everyday. Still not huge numbers but it’s a start right?

I follow five simple rules that I believe helped me build a successful website, five rules that everybody can follow.

  1. I posted simple, honest content. Most the content on my website is designed for people with little technical expertise who need to solve a problem. This is an easy way to generate traffic, find a problem and help people solve it.
  2. I posted content often. While I was building my website traffic I often posted content twice a day to help establish new visitors, then once I knew people had taken the time to read my posts I began posting less frequently but with more focus on content.
  3. I posted what people wanted. I spend a lot of time looking at the stats for my website and I know what articles people read and which are worthless. The articles people read inspire me to write more (better) content on similar subjects while the less popular posts are reviewed and improved.
  4. I posted different kinds of content. When I started out I made a lot of mistakes (and still do) but by testing different content styles, I’ve learnt the proper length for many posts and how to make them more readable for the audience.
  5. I posted what I knew about. Instead of trying to chase trends or break news stories, I posted content designed to help business owners make better websites, a lot of it is still pretty technical but it’s getting more ‘people’ friendly everyday.

What I’ve learnt over the past five months is that people love free stuff. My post popular page by far is Fundraising Thermometer Plugin for Wordpress a free plugin for WordPress designed to help charities display their current fundraising level. My second most popular post is another WordPress plugin called WordPress Plugin to automatically update the copyright notice., a simple post to allow the display of copyright details on a post. Other popular posts on my blog have been:

  1. How to center content with CSS and HTML
  2. No More Frames Plugin for WordPress
  3. Code Free Pong
  4. How to make awesome 3d icons in Adobe Fireworks
  5. How to create a reflective website image in Photoshop

As a website owner, the best way for you to increase your website traffic is to understand what people want and give it to them. This might sound like common sense logic but often times we as business owners (because my website really is a business) forget that serving content is about the reader, not the writer.

Happy five months of reading my website, I look forward to another great month writing.

What image format should you use on your website?

There is nothing more complex about publishing on the web than the concept of images, they’re quite possibly the hardest part of HTML for the general public to get their minds around so let’s take a quic look at what makes an image complicated and how we as web designers and publishers can approach them in a simpler way.

Image Format

The first step to web graphics is to appreciate that images come in dozens (or hundreds) of file formats from BMP’s to TIFF’s and everything in between but when it comes to the web, there are really only three formats for you to think about:
  • The CompuServe Graphics Interchange Format (GIF) format (pronounced giff)
  • The Joint Photographic Experts Group format, JPG (pronounced jaypeg)
  • the Portable Network Graphic file format, PNG (pronounced ping)
Close up of the GIF file format

Close up of the GIF file format

These three file formats encompass the entire spectrum of Internet based graphics. The first format, GIF was introduced way back in the very first days of computer graphics (1987) and allowed people to exchange graphic files via an online community similar to America Online (AOL). The GIF format was limited to 8 bits of color (255) with some reserved for core data. It was a loss-less graphic format ideal for the graphics of 1987 but could hardly produce quality photos.
The GIF format stores each pixel of an image as one of 255 possible colors resulting in a crisp image. The GIF format however also had a number of unique benefits such as the ability to have invisible (alpha) transparent  pixels which when place overtop of other colors would allow the backgrounds to remain visible and the capacity to store multiple GIF images in a single file as pages. When displayed in a web browser or other image viewing tool these pages would appear as animations similar to old ‘flip book’ style animations.
In 1992 the  Joint Photographic Experts Group created and issued the JPEG standard to the world. These days we tend to call the file format JPG since old Microsoft based computers could only hand three characters as a file extension but the format is also known as .jpg, .jpeg, .jpe, .jif, .jfif  and .jfi. The .jpg format was an instant success, it quickly addressed the primary failings of the GIF format by allowing 24 bit graphics (16.7 million colors) and smooth transitions between the these colors using a lossy compression method … which is a fancy way of saying the graphics blended together.
Lossy file saved as both 20% and 80%

Lossy file saved as both 20% and 80%

In effect, how the JPG standard worked was to rapidly reduce file sizes by averaging the color values of a pixel with those around it. This caused massive reductions in file sizes allowing photographers to post 500kb images in extremely small (20-100kb) files while controlling the loss of quality. To the right you’ll see an image saved at 20% quality to the left and 80% to the right, both the difference in quality and the method JPG uses to reach the results should be evident.

Before I go on, I want to pause and take note of a statement I made in the above description because I’m sure most people missed it or brushed past without much thought … the JPG file format was introduced to the world in 1992. This phrase is critical because it reinforces how much the world has changed in just 17 years. For those of you who are under 20 years old, you’ll most likely have never known a world without Facebook or YouTube but for the rest of us, we sometimes forget the Internet is for all purposes a fairly recent addition to the world. I’m 35 years old and I remember the first JPG photo that I saw, the introduction of this format changed the way we shared images over computers.  Notice that I said it changed the way we shared images over computers? There was no Internet, or at least not what you see today.

In 1996, Unisys became uppity and started threatening to sue over the LZW compression found in the GIF format so the world invented the Portable Network Graphic format (PNG), along the way the format improved upon most of the qualities of the GIF and lost the capacity for animation. The PNG format has 8 bit graphics similar to the GIF but also has 24 bit like the JPG and introduced a new level with 32 bit graphics. While it lacks support for animation, it includes transparant pixels like a GIF. Unlike a GIF, where those pixels can be on or off the PNG allows for alpha transparency making the format extremely flexible and also capable of compressing images. The problem with the PNG format, is that it produces large files.

export dialog What image format should you use on your website? image

So which is best? Actually that depends entirely on what you want to accomplish with the graphics. As you’ll see from the image above the file size of the graphic can range from ~25k to ~430k depending on the quality you’d like to achieve.  Photographers for example should use the JPG compression most often to ensure their images are strong, crisp and colorful while illustrators and others who work with line art will benefit from the GIF format. In the end, practicing and experimenting are the best ways to determine what you should be using.

A quick thank you to the Old Shoe Woman for posting the a wonderful photo Sunlight Under a Live Oak Tree on Flickr for me to use as part of this tutorial. 

Hyper linking in Dreamweaver

HTML is all about something called Hyper Linking. Actually, that’s what the first two letters of HTML pretty much stand for … Hyper Text Markup Language but what does it actually mean? Well, oddly enough us geeks are not all that tricky to understand, give us a beer mug shaped like Yoda’s head and let us string together a few acronyms and we’re happy.

Hypertext is text on a page that contains a Hyper Link

A Hyper Link is a piece of text or graphic which links to another document. When a user clicks the Hypertext, they follow the Hyper Link to the new document. Not brain surgery but I completely understand how most people would never need to know that.

Using Hyper Links in Adobe Dreamweaver is, for the most part dead simple. To insert a hyperlink into your Dreamweaver document, simply ensure you are in Design mode and select the text you want to make a hyperlink. Next, using the Property toolbar, type the website address you’d like to link to.

How to make a hypertext link in Dreamweaver

How to make a hypertext link in Dreamweaver

There are actually several things you can do with a hyperlink, called protocols. Most people only ever know about the http:// protocol (the Hyper Text Transfer Protocol) but there’s also a ton of other protocols people could use including the https://, ftp://, mailto://, gopher:// and of course the nntp:// protocol. If you have no idea what these are, congratulations … you’ll almost never need to care in your life unless you’re a hard code web developer.

Once you’ve added an http:// link using Dreamweaver you can also force the clicked link to open in a new web browser simply by adding the phrase _blank to the Target field of your property bar. There are a couple of other neat tricks with anchor tags people should be aware of, but to accomplish them we’re going to have to switch to Code view in order to see the following code:

[source lang="html"]<a href="http://www.thisismyurl.com">This is my Hypertext.</a>[/source]
In addition to the href value (where the click will go), you can also add:

  • accesskey to make the link a keyboard shortcut
  • class to assign a CSS class
  • dir (rtl or ltr) to make the text run right to left or left to right
  • id to make the anchor text have a proper name
  • lang to assign a language value
  • style to format the tag
  • tabindex to index the tab order for the link
  • title to assign a title tag
  • rel for the link relationship.

Of these I would recommend most links on a website have an href value to show where people should go, an ID if it’s a critical link, a rel for defining relationship values and the title for SEO value. Typically then, a link should look like:

[source lang="html"]<a rel="nofollow" title="My Great Website" id="mainlink" href="http://www.thisismyurl.com">This is my Hypertext.</a>[/source]

Absolute Paths vs. Relative Paths

One of the great debates in web publishing is the choice between using absolute paths vs. relative paths. An absolute path is one which is mapped completely to the final destination (http://www.thisismyurl.com/tutorials/placing-page-content-in-adobe-dreamweaver/) vs. one that is linked relative to the document you’re currently reading (../placing-page-content-in-adobe-dreamweaver/) the main advantage of an absolutely path is that it’s locked, while the main advantage of a relative path? That’s it’s relative … in the end, it doesn’t matter so long as the link works.

This tutorial is part six in a ten part series.
  1. Preparing a website in Adobe Dreamweaver
  2. Building your first Dreamweaver Template file
  3. Structuring your website with Adobe Dreamweaver
  4. Improving the common elements in Dreamweaver
  5. Placing page content in Adobe Dreamweaver
  6. Hyper linking in Dreamweaver
  7. Working with Images in Adobe Dreamweaver
  8. Adding Cascading Style Sheets with Dreamweaver
  9. Putting your website on a remote web server with Adobe Dreamweaver
  10. Adding Google Analytics to your Dreamweaver Template

How to make awesome 3d icons in Adobe Fireworks

preview blogger 300x150 How to make awesome 3d icons in Adobe Fireworks imageSo last week I put up some great new icons for social bookmarking websites, then I went ahead and did it again. So you may have expected me to upload another set this morning but sadly, I’m most likely on an airplane at the moment or sitting in an airport waiting for our regional carrier to figure out if they remembered how to fly a plane or not.

Instead of uploading another awesome set of icons, I decided to try my hand at doing a video tutorial on YouTube instead. That’s right folks … now you can not only spend countless hours reading my rants, you can listen to me too!


 

During the tutorial I mentioned that you can download the files from my website, so here they are: 

How to center content with CSS and HTML

All too often I’ve found inexperienced designers using <table> tags to center content on a website, they always have the same reasoning and while I appreciate they didn’t know the proper way to do it, that’s no excuse.

First, let’s all accept that <table> tags are designed for one thing and one thing only … tabular data. You wouldn’t use a spread sheet to design a business card, so don’t use a table to design a website.

Now, if you’d like to center a website across all browsers there’s a few things that you’re going to need to do.

The HTML

First, in your HTML you need to create some <div> containers. Here’s all you need:

<body>
<div id=’container’>
Content
</div>
</body>

The CSS

Next, you need to write the CSS code to center your content:

body {
text-align: center;
}

#container {
margin: 0px auto 0px auto;
text-align: left;
width: 80%;

There you go, that’s all you need to center a page using pure HTML and CSS.

How does it work?

The CSS file instructs the <body> tag to center the content using the text-align option. Then, it tells the <div> tag named container to do three things:

  1. Set the margins to nothing at the top and bottom but automatically find the right and left. In CSS this is represented by margin: top right bottom left.
  2. Next, realign the text to the left. Since we’re using Cascading Style Sheets the effect of the earlier text-align: center would otherwise affect our text.
  3. Finally, set the width of our page container to 80%.

Reflective image effect in Adobe Fireworks

Original Image

Original Image

I just wrapped up a tutorial of how to create a reflective image in Photoshop but then I got thinking how much I love Adobe Fireworks so why don’t I have a tutorial for it as well?

So, the first thing that we’re going to need to do this tutorial is an image. Luckily there are 49 stunning images left to choose from, so I’m going to  use an image from Zach to accomplish my tutorial. I used another great image in the Photoshop version of this tutorial so I thought it was only fair to use another.

Setting the Canvas Size

Setting the Canvas Size

Working with Fireworks is a lot different than Photoshop, so this tutorial is actually easier to follow for new users.

First, let’s load the image into Fireworks and increase the canvas size to be 500px x 500px, remembering to keep the image centered at the top of the new canvas.

Once this is done, our image will have a large checkerboard pattern along the bottom of it. This represent an empty area in the document and will be saved as either Transparent in a PNG file or white in a JPG file.

Use your mouse to selected the image, you’ll see that the image is selectable because a red line with small red boxes will appear. When the image is selected, the red line will appear blue.

Next Copy (Control-C) and Paste (Control-V) the image to make a duplicate of the image.

To flip the image, use the Modify > Transform > Flip Vertical option from the menus which will flip your image upside down. I’ve seen a lot of student try rotating the image to do the same thing, it’s not the same thing so don’t try it. We want to create a mirror image not a rotated image.

Mirror Image

Mirror Image

 

 

You’ll have to drag the image down a little to line it up with the bottom of the first image, this will create a mirror that we need to lighten and create a white gradient with.

Lightening the picture is pretty easy, all you need to do is alter the opacity of the image. You can find the opacity on the Properties panel (Apple-F3) over on the far right hand side. Change the number 100% to the 50% in order to lighten the image and cause the background checkerboard to bleed through.

Adding a white gradient mask in Fireworks is also very easy, let’s create a new box using the Rectangle tool option found on our Tools panel (Apple-F2) to draw a box over the bottom image. Remember, you can resize the box using the corners to drag and grow or use the numerical values in the Property panel to resize and reposition the box.

Linear Fill

Linear Fill

We want to set a Linear Gradient from the Property panel. This option is a little hard to find at first, you have  to click the menu labeled Solid by default and pull down to Gradient, over to Linear. Don’t worry about the color at this point we’re going to change it at the next stage.

Now, surprisingly we’re already at the final step of our tutorial.

We need to edit the settings of the Linear fill to accomplish two things:

  1. First, we want to ensure both the colors in our fill are white. This is done by setting the two bottom colors to white.
  2. linear fill settings Reflective image effect in Adobe Fireworks imageSecondly we need to edit the opacity of our fill using the two top options. By setting the start fill to an opacity of 0%, the white box will fill only the area we want.
final image 300x300 Reflective image effect in Adobe Fireworks imageIf you’ve done everything right, what you should be left with is a reflective tree, perfect for use on your website. 
I’ve included a copy of the working file or you to view how this was done.

How to create a reflective website image in Photoshop

A while back, I wrote a simple tutorial for Photoshop on creating reflective text in Photoshop CS3, I’ve had a lot of people interested in it over the year and a couple have asked me how to apply this same technique to images, photos or even screen shots of their website.

The original image.

The original image. (right-click to download)

Creating a reflective screen shot in Photoshop is pretty straight forward. First, you’ll need a great image. For that, I’m going to borrow an image from thefuturebuzz.com’s great finds on Flickr and use a Raindrop image by play4smee (most likely not his/her real name).

Now what we want to do first is open the image in Adobe Photoshop. If you don’t already have a copy, why not download a free trail from Adobe or take the time to win one from me? Now that you have your image open, let’s do some basic resizing to make sure we’re all working on the same page.

I’d like to use the Image > Image Resize … menu option to reset the width of the file to 400px and you’ll see the height should auto set 286px.

To create the reflective effect we need to do a few fancy steps to our Photoshop document which are actually pretty easy but sound complicated. 

First, we need to reset our color pallet to the defaults. We do this so that we’re working with a black and white foreground. To do this, simply press the D key. This will reset your pallet to the default values.

Two Layers

Two Layers

Next we need to copy the image to a new layer. There are a couple ways to do this but I’m lazy so lets selected the entire image (Control-A on a PC or Apple-A on a Mac) and the cut the image out with a Control-X or Apple-X command. Finally, paste using Control-V (if you can’t figure out the Mac command, you shouldn’t be reading any further). What you should be left with is two layers, the top most being an image of the leaf.

For the record (because I can already here some people shouting about alternative methods) you could have accomplished the same thing by dragging the Background to the page icon at the bottom of the layer menu and then deleting the content of the background … which would have done the same thing but confused a lot of new users. You could also have accomplished this using menus instead of shortcuts but what fun would that have been right?

Duplicate the Layer a second time so you end up with two Layers plus the white background.

Next, you’ll need to reset the size of the document using the Image > Canvas Size … menu option.

Canvas Size

Canvas Size

First, we want to make sure that you’re going to increase the canvas at the bottom of the image so we darken the top center option in our “tic-tac-toe” board. 

Secondly, let’s switch the inches option to pixels, this will allow us to work in the same unit of measurement as we did when resizing the image. Not that it really matters because I would like you to increase the Height of the document to 400px (or 5.556 inches).

When you click OK you’ll be returned to your document which now has a large white sash across the bottom of it. This is where we are going create the reflection effect for our image.

To create the effect, make sure you’re on the top leaf photo in your Layer menu. If you can’t see your Layer menu you can activate it using the Windows > Layers menu item or by pressing F7. Sometimes when I lose the window I like to press F7 just to see it disappear and then reappear.

Reflective Leaves

Reflective Leaves

 

Control-T will begin the Transformation process for your image, Photoshop will automatically find the image on the layer so there’s no need to select anything. At the very bottom of our image, in the very center is small square box. Right click this box to reveal the Flip Vertical option and click it, making your image flip upside down. Now press the Enter key to accept this change. For those of you who prefer menus you can do the same thing using the Edit > Transform > Flip Vertical option. 

Now that you’ve reached this point, you’ll want to select the Move tool (V) and drag your top layer so that it is at the bottom of your top layer. This will cause a reflective mirror image between the two layers which is very close to being completed.

Ideally we want to wrap this up by fading the bottom image to white and making it appear light enough that it could reasonably be a reflection in glass.

Final Layer Structure

Final Layer Structure

To do this, we need to adjust the Opacity settings of the Layers and add a Layer Mask to the layer. Opacity is easy, in your Layer pallet simply change Opacity: 100% to Opacity: 50%. This will lighten the overall content of the layer, as you would see in a reflection. 

Next, add a Layer Mask using the third icon on the bottom of your Layers pallet and we’re ready to add the gradient to your image to complete the effect.

Before I continue I want to explain that a Layer Mask is used by Photoshop to knock out an area in an image, it’s literally a mask on your image so anything you don’t want to see you can simply use black paint brush to block out. We’re going to do something similar but with a gradient tool.

Selecting the Gradient Tool can be a bit of a pain, sometimes it’s hidden under the Paint Bucket tool in the Tool menu. First, let’s make sure you can see the Tools menu. If not, it’s under Windows > Tools. Now select the Gradient tool (G) or click the Paint Bucket and hold your button down until the Gradient tool appears and then select it.

reflective image 300x300 How to create a reflective website image in Photoshop imageWith the Gradient Tool selected, drag a line (hold the Shift key to make it straight) from the top of your reflective edge (where the two images come together) to the bottom of your image. You can adjust the depth of reflection to meet your desired effect.

Show both links and pictures in WordPress wp_list_bookmarks()

showingbothlinksandpics 153x300 Show both links and pictures in WordPress wp list bookmarks() imageAs some of you may have noticed, I updated the design for my site this week. It was a pretty major overhaul of the basic code, although it is still 100% WordPress. The upgrade that I’ve had the most messages about is my links list at the bottom of the page. It uses the standard WordPress Links list with a few minor scripting changes.

By default, WordPress wp_list_bookmarks() will display either the graphic or the title of your link but not both. If there is a graphic image set, it will simply ignore the title and output only the graphic. If no graphic is present, it will only output the text. Not exactly what I wanted.

What I wanted was what Jeremy had. So I set about trying to find the code to do this in WordPress only to find out that it simply didn’t exist. What I did find was a lot of people grumbling about it, so  I fixed the problem using WordPress’s built in get_bookmarks() function.

Here’s what I did:

<strong>What I’m Reading</strong>
<ul><?php 

$linklist = get_bookmarks(‘category=70′); 
foreach ($linklist as $site) { 
echo “<li>”;
if (strlen($site->link_image)>2) {
echo “<span class=’linkimage’>”;

echo “<a href=’”.$site->link_url.”‘ title=’”.$site->link_description.”‘ rel=’me’><img src=’”.$site->link_image.”‘ alt=’”.$site->link_name.”‘/></a>”;
echo “</span>”;

} else {
echo “<span class=’linkimage’></span>”;
}

echo “<span class=’linkname’>”;
echo “<a href=’”.$site->link_url.”‘ title=’”.$site->link_name.”‘ rel=’me’>”.$site->link_name.”</a>”;
echo “</span>”;
echo “</li>\n\r”;
}
?></ul>

For those of you who know PHP what I did was pretty simple but for the rest of you, here’s the basic breakdown:

$linklist = get_bookmarks(‘category=70′); 

Get the values of category #70 (I only wanted those links) and load them into a variable.

foreach ($linklist as $site) { … }

Loop through the variable.

if (strlen($site->link_image)>2) { … }  else { … }

If the link_image value (that’s where the image is stored) has a value of more than two characters, do this. Otherwise, do something else. For the record, sometimes the value returned a false positive when testing for isset() so I choose to do a strlen() instead.

echo “<span class=’linkimage’>”;
echo “<a href=’”.$site->link_url.”‘ title=’”.

$site->link_description.”‘ rel=’me’><img src=’”.$site->link_image.”‘ alt=’”.$site->link_name.”‘/></a>”;
echo “</span>”;

The code above displays a <span> tag. I repeat the process if there’s no image found using an empty <span> tag to keep the text alignment appropriate.

echo “<span class=’linkname’>”;
echo “<a href=’”.$site->link_url.”‘ title=’”.$site->link_name.”‘ rel=’me’>”.$site->link_name.”</a>”;
echo “</span>”;
echo “</li>\n\r”;

Finally, I display another <span> called linkname which stored the text based hyperlink to the site. 

That’s all she (actually he) wrote … do you have any suggestions how to improve this code? Let me know and I’ll owe you a pint. Also, if you use this code please post a link to your website below so that I can see it in action. Thanks.

Structuring your website with Adobe Dreamweaver

For those of you how have been following my series on building a website in Dreamweaver, you’ll know that we’ve already setup a Site, created the four basic pages of our website and assigned a Template to the files. What we have now is technically a website but it’s lacking a lot.

What we want to cover in this lesson is how to structure your web pages and website to be effective. This isn’t about Dreamweaver, it’s about web standards and ensuring your website is compatible with the expectations of groups like the W3C and search engines such as Google. It’s also common sense and if you can get in the habit of building a website properly, it becomes easy to do maintain it later.

Adding a menu to the Template

picture 2 300x213 Structuring your website with Adobe Dreamweaver imageSo our first step today is to add a menu to our website. To do this, we need to open the Template file we created already and add both text and links to the other files. This is going to be our menu, so let’s start by making sure we’re in Design view and placing a new paragraph after the word Header.

On the new line that we’ve created we want to type the word Home and press Enter. On the new line, let’s make a new entry for Services and add a new line. Do the same for Contact and About.

Now for something really cool. What is a menu? It’s a list of pages on our website so, let’s make it a list and let’s tell Google that it’s a list. To create a list in Dreamweaver, we are going to highlight the four lines Home, Services, picture 31 Structuring your website with Adobe Dreamweaver imageContact and About by holding down our left mouse button and dragging the cursor over the four lines. Then, using the unordered list button on our Property panel (if you don’t have a Property panel go to Windows > Properties) we will make our menu an unordered list.

picture 6 Structuring your website with Adobe Dreamweaver imageAdding the hyperlinks to our menu is our next step. Select the word Home and again using our Property panel, let’s add a new link by clicking the folder icon. Find your index.html page from the list and select it. This will turn the word Home blue, indicating that there is now a hyper link on it. Do the same for Services, About and Contact and you’ve built a menu for your website. As a note, you can also add the hyperlink by dragging the target (circle with a target on it) to your Files panel to the right and point it at the filename.

Applying your changes to your site

Pressing Control-S at this point will Save your file and also prompt you to see if you’d like to update the rest of your website. Yes, we want to update the website. This will apply the changes from your template to the other four pages we’ve already created.

Building the footer for your pages

A header and a footer are basically the same on a web page, the difference being that we want one at the top and the other at the bottom but it’s best practice to have a menu on both. To add a menu to our footer we could follow the above steps or we could use Dreamweaver to make our life easier.

picture 71 300x160 Structuring your website with Adobe Dreamweaver imagePlace your cursor anywhere in the top menu, say for example beside the word About. You’ll notice at the bottom of your Design View document that there’s a string of HTML that reads something to the effect of <body><ul><li><a>, this is the document structure of your current object. Basically it’s saying that your cursor is located:

  • Within the Body of your document
  • Within an Unordered List
  • Within a List Item
  • Within the Anchor tag

Your document may not be exactly the same but what’s important is that you’re within the <ul> of your list. Along the bottom of your window, click the <ul> tag and you’ll see that you’ve selected the whole list (all four items). Simply Copy (Control-C) the object and you’ll have the whole menu in memory.

Now, you can go to the bottom of your document and place your cursor after the word Footer and Paste (Control-V) the menu. If you did it right you should now have a copy of your menu at the top and the bottom of your page. Click Save and update your pages. If you’d like to see your work before moving on, you can do so by opening the index.htmlfile in your Files panel and Preview (File > Preview in Browser). When you’re done, close the index.html file.

Adding Divisions

Web sites have many parts, in our case we have three distinct areas of our website:

  • Header
  • Content
  • Footer

It’s time that we tell Dreamweaver that we have different areas of our website. This is important later when we get into designing our website. So, to do this we want to select the whole area of each piece and add a Division tag.

Let’s start by selecting the whole Header of our document. We do this by placing our cursor in front of the word Header and selecting all the way to the end of the word Contact. Once that’s done, we need to make sure we have the picture 9 Structuring your website with Adobe Dreamweaver imageCommon area of our Insert panel (Window > Insert) up and select the icon for the Division tag. The icon for our Div tag is the fifth from the left, between the Table and the Image icon. Clicking this icon will prompt us for an ID or a Class name.

picture 8 300x125 Structuring your website with Adobe Dreamweaver imageI’m going to take a moment and pause here, to describe the difference between the two.

A Class is used to describe a Div tag for example, you could describe a Class a needing padding, or telling the browser that this class is blue.

An ID on the other hand is giving the Div a unique identifier on the page. I’m reluctant to use the word Name because that has a different meaning in HTML but for lack of a better word, the ID is the Name of the Division.

We want to set the ID of the Div tag to header. This will tell web browsers that the material contained within this section is for the header of our document. When you’re done that, Dreamweaver should wrap a Div tag around your entire header which will appear to have no difference to you (except putting a grey line around the area) but for our layout purposes it’s huge.

Now do the same to the Footer area, calling this Div tag footer.

Finally we have to set the Div for our content area. To do this, we need to place our cursor at the end of the word Content and along the path of our document structure (at the bottom of the page) we need to select mmtemplate:editable. This will select the whole of the editable region. Adding a Div tag called “content” at this point will be our final step in making our document structure for this tutorial.

picture 10 300x160 Structuring your website with Adobe Dreamweaver imageI’ve included a screen shot to the right (you can click to enlarge it) of the Template file so far. What you should notice is that we have a document with three distinct areas:

  • Header
  • Content
  • Footer

The Header contains:

  • A Title
  • A Menu with four items, each hyper linked

The Content contains:

  • An editable area named Content

The Footer contains:

  • A Title
  • A Menu with four items, each hyper linked.

Wrapping up

Save your Template and update your pages, you can preview your work to date and hopefully you’re still with me. If you have any questions or comments please let me know using the comment area below, I hope you’re enjoying the tutorial so far.

This tutorial is part three in a ten part series.

  1. Preparing a website in Adobe Dreamweaver
  2. Building your first Dreamweaver Template file
  3. Structuring your website with Adobe Dreamweaver
  4. Improving the common elements in Dreamweaver
  5. Placing page content in Adobe Dreamweaver
  6. Hyper linking in Dreamweaver
  7. Working with Images in Adobe Dreamweaver
  8. Adding Cascading Style Sheets with Dreamweaver
  9. Putting your website on a remote web server with Adobe Dreamweaver
  10. Adding Google Analytics to your Dreamweaver Template

Building your first Dreamweaver Template file

If you’ve made it this far, you’ve most likely already completed my first step in this tutorial called Preparing a website in Adobe Dreamweaver. If not, I’d suggest hopping over and following the steps, it should only take a few minutes and will get you ready for the next part. So far, you should have created a Site in Dreamweaver, opened your Files tab and made four new web pages each with a little bit of silly content in them. With luck if you open any one of the pages you’ll see different content depending upon which one you open.

Now this is important so please read this part … building web pages is not about designing web pages. The two are very different subjects and we’ll get to the design a little later but for now, let’s keep your View in Design (View > Design in the menu) and focus on making our website technically accurate. Once that’s done, we can make it really cool.

In Adobe Dreamweaver we can create short cut files called Templates which allow us to store the common aspects of multiple pages in a single file. These common files most often include the header and footer areas as well as common side bars of a website which allows us to address some of the most basic principles of website design.

CRAP. Yes, I said it.

CRAP is a basic principle of design which breaks a creative project into four areas, my belief is that if your layout features all four it’s a good design but if it’s lacking any one of the four, it isn’t. CRAP stands for:

  1. Contrast
  2. Repetition
  3. Alignment
  4. Placement

Each of the lessons we cover in this series helps reinforce these four basic concepts, in this tutorial we’re talking about Repetition. Each web page in your website should have the same basic design and layout regardless of the page. We’re also addressing Placement by placing the correct content in the correct areas. Just wait, in lesson three we’re going to talk about the structural hierarchy of xHTML documentation publishing … very exciting.

Creating a Template in Adobe Dreamweaver

If we wanted to we could just add the header and footer HTML into each of our pages but that would lead to human error and sloppy coding, more importantly as the site grew it would mean that we had to change dozens or hundreds of pages instead of just a few. I’m too lazy to be faced with hundreds of updates every time I want to change a common element so instead we need to find an easier way and luckily with Dreamweaver it’s a pretty simple short cut.

picture 4 300x189 Building your first Dreamweaver Template file imageUnder the File > New option you can create a Template by selecting Blank Template > HTML Template > <none> this will open a new window similar to the one we created in our last Tutorial but this time it’s a Template file. Saving the file will prompt us with a new dialog box which is going to prompt us for the name of our new Template. I’ll call mine Untitled-5 but you can name yours anything you’d like.

Once you’ve saved your Template you should notice a new folder in your Files panel called Templates. This is where your template files are stored, if you double click the folder you’ll see a new file with the extension .dwt, this is your template file.

Adding an Editable Region to your template

While Templates are amazing for duplicating you’re content across multiple pages, you’ll need to be careful so that you have the ability to have unique content on each page. By default a Template will apply itself over top of all your local content so we need to add an Editable Region.

Before we do this, I want you to type the following three words in your Template document, each word should be on a line by itself.

contenttemplate 300x145 Building your first Dreamweaver Template file imageHeader

Content

Footer

Now that we have these three key elements of the website design labeled, I want you to add an Editable Region by first selecting the word Content and then going to the menu item Insert > Template Objects > Editable Region. It will ask you to name your region, let’s call it Content to make thing easy. When you’re done this process the work Content should be surrounded by a blue outline with the title Content. Congratulations, you’ve just added an Editable Region to your template. Now, when we update the content across your website you’ll be able to instruct Dreamweaver where to put the content you previously entered.

Let’s save the Template file and close it now.

Applying your template to pages

A Template is great but useless if we don’t apply it to pages so that’s exactly what we need to do now.

picture 7 300x201 Building your first Dreamweaver Template file imageOpen about.html and select Modify > Templates > Apply Template to Page … so that we can apply the template file to your page. We need to select the template from the Templates list and click OK to continue. Next we’ll be asked where we want to put pre-existing content, this is the content we placed in lesson one and it’s important that you select the content and specify you that original content to appear in the proper area. If you named the Content area Content as I wrote, you should select that from the drop down box. Once you’ve done that, click OK and you’re done.

When you view your about.html file in Dreamweaver you should see a yellow line around the main text area and the words Header and Footer outside those areas. This yellow line represents your Editable Region in your Template object. Everything outside the yellow is stored in your template file and can not be edited while on this page.

Save your work and apply the same template to your three other files, when you’re done your website has a proper Dreamweaver Template file attached and you’ll be ready for lesson three, in which we’ll cover how to structure your HTML document.

This tutorial will be broken down into the following chapters, each published individually over the coming weeks.

  1. Preparing a website in Adobe Dreamweaver
  2. Building your first Dreamweaver Template file
  3. Structuring your website with Adobe Dreamweaver
  4. Improving the common elements in Dreamweaver
  5. Placing page content in Adobe Dreamweaver
  6. Hyper linking in Dreamweaver
  7. Working with Images in Adobe Dreamweaver
  8. Adding Cascading Style Sheets with Dreamweaver
  9. Putting your website on a remote web server with Adobe Dreamweaver
  10. Adding Google Analytics to your Dreamweaver Template
How are you doing so far? Leave me some feedback so that I know how to improve this template as we move along.

Preparing a website in Adobe Dreamweaver

Let’s take a look at how to create a website properly using Adobe Dreamweaver, this tutorial will go over the straight from the start of the process to uploading your website to a web server on an Internet Service Provider. I’ve purposely tried to keep this tutorial fairly basic as it’s designed to a new web designer and can be considered fairly basic but at the same time, I wanted to introduce some of the more complex concepts we find in Dreamweaver and on the web in general.

Preparing a website in Adobe Dreamweaver

As we prepare to create a website in Adobe Dreamweaver, we first have to understand what a website is and how we can make the most of it. Frankly, anybody can create a website and there are a million tutorials out there which will teach you how to do it but if I’m going to take the time to write about it, I’d like to help you learn to do it the right way.

What is a website?

A website is a collection of documents, images, text, media and links associated in a common place. Most likely it’s hosted on the Internet but it doesn’t have to be, most importantly it’s a collection of web pages.

What is a web page?

A web page is a document written in the Hyper Text Markup Language and is designed to be read by web browser software. A web page may contain text, graphics, images, rich media and links. Why am I taking the time to explain it to you at this basic a level? Ironically in my career I’ve found a lot of web professionals who don’t really understand the basic concepts so if you’re new to this, it’s worth a review.

Now, a web page may seem like a simple thing but before we go and start creating a million fancy pages we want to create the website container in Dreamweaver so that all of our pages are properly associated and we can take advantage of Dreamweaver’s site management functions. If you don’t already have a copy of Dreamweaver, you can download a trial version at www.adobe.com

Creating your first site in Dreamweaver

picture 3 300x289 Preparing a website in Adobe Dreamweaver imageAdding a site in Adobe Dreamweaver is fairly simple, along the top menu you can create a New Site … under the Site menu item. Once created a dialog box will appear. The are two modes to add a website to Dreamweaver, Basic and Advanced. Let’s make sure you have Basic selected and take a look at the options provided.

First, you’ll need to create a name for your website. You can call it what ever you like, this title is for you and you alone. I’m going to call mine Unnamed Site 2 because I’m original and like the sound of it.

The HTTP address is the website address of your site. If you don’t already have a domain name, don’t worry about it. Otherwise, fill in the URL of your website here. For example, my website address is http://www.thisismyurl.com.

Clicking on the Next button will bring us to a screen asking about Server Technology. For now, let’s say that we do not want to use a server technology. Using this option later will let us use a scripting language such as PHP but we’ll get to that later.

We click the Next button again and Dreamweaver wants to know where we’d like to edit our site. We can choose to edit on our local computer, in which case we’ll need to add a local folder to our hard drive or we can edit remotely on an FTP server. So let’s add a local folder and link it in the dialog box provided.

When we click the Next button again you’ll find yourself on a screen asking about remote access. This is for people who want to FTP or upload their websites to a remote web hosting company. By default Local/Network is selected but I want you to change it to None and press Next. We’re going to cover how to FTP our site and things later on, so let’s not get too bogged down in technical talk at this point.

If you’ve done everything correctly you’ll now see a Done button and you’re ready to get started with your website. At this point, you’re going to notice that it’s not very exciting. In fact, it’s empty but that’s OK because that is exactly how we want to start a website.

Adding files to your website

If the purpose of a website is to hold web pages, we now need to add a web page. To create a new web page in Dreamweaver we have a few choices:

  • You can create a new page using the short cut key Control-N (Apple-N on a Macintosh)
  • You can create a new page using the menu option File > New …
  • You can right click (ctrl-click on a Macintosh) the Site name in your Files panel to the right. If you don’t have a Files panel, hit F8 or go to your Windows > Files menu item.

Now, if you took the first two options you’ll see a big and scary dialog box (the third option skipped this step) asking you what type of page you want to create. Let’s keep the ball rolling on the simple tutorial and select Blank Page : HTML : <none> from the menu. Don’t worry about the rest of the items, just click Create to continue. This will create a new file but it’s not added to our site yet.

To add the site to your website you need to File > Save (Control-S / Apple-S) your document. For the sake of compatibility down the road, I’d like you to name this file index.html and save it. Now, on in your Files tab you should see your Site as well as a single file named index.html. Congratulations, you’ve created your first (single page) website.

You can repeat the steps outlined above to add three more pages to your website, in the end you should have:

  1. index.html
  2. about.html
  3. contact.html
  4. services.html

In our next lesson we’ll learn how to create a website Template file which is used to control the structure of your website. Before then, why don’t you take the time to add a couple paragraphs of text to each of the pages? Remember to make sure you’re in Design view by going to your View > Design option (if there’s a check mark on it you’re OK). Having a hard time thinking about what to say? No problem, at this point in the process why not just copy some Lorem Ipsum into each page?

This tutorial will be broken down into the following chapters, each published individually over the coming weeks.

  1. Preparing a website in Adobe Dreamweaver
  2. Building your first Dreamweaver Template file
  3. Structuring your website with Adobe Dreamweaver
  4. Improving the common elements in Dreamweaver
  5. Placing page content in Adobe Dreamweaver
  6. Hyper linking in Dreamweaver
  7. Working with Images in Adobe Dreamweaver
  8. Adding Cascading Style Sheets with Dreamweaver
  9. Putting your website on a remote web server with Adobe Dreamweaver
  10. Adding Google Analytics and other neat tricks to your Dreamweaver Template

Was this tutorial easy enough to follow? Let me know through your comments below.

How to Create Reflective Text in Adobe Photoshop CS3

tutorials/photoshop/createanewdocument.jpgThis is a simple tutorial used in some of my classes to help first year design students understand the basics of Adobe Photoshop as well as how to use Layers properly.

First, lets start by creating a new document using the CTRL-N button and we’ll set the size to 200px wide by 100px high. This will give us a simple work space to create our document from.

Now, using the text tool (tutorials/photoshop/texttoolicon.jpg) let’s type some basic text such as “Hello World” in the center of our document, you may want to resize the text or alter it to create the effect you want. Once complete, let’s duplicate the layer by using the CTRL-J shortcut or selecting Duplicate Layer from the Layer menu.

tutorials/photoshop/layers.jpgThe duplicated layer (most likely named Hello World Copy or something similar) will appear above your first layer in the Layers pallet on your right hand side. The new layer is going to be used for the rest of this tutorial so be sure that you have it selected and we’ll continue.

The next step is to Right Click on the layer to expose the dynamic menu, use this menu to find and select Rasterize Text. Your text is now just a series of pixels and is no longer editable, this is exactly what we want.

With the freshly rasterized text layer still selected we’ll use the CTRL-T keyboard shortcut to transform the layer. Your image text should now have a series of six small hollow squares around them. Right Click any of the boxes and select Flip Vertical.

Now drag your selected text until the top of it lines up with the bottom of your initial text, what you should be left with is a copy of your original text mirrored directly below it.

Our final step in this tutorial is to make the text appear reflective which involved fading it gently and to do this, we want to add a layer mask which is a method of adding transparency to an object gradually.

layermask How to Create Reflective Text in Adobe Photoshop CS3 imageTo do this, we want to use the menu item Layer > Layer Mask > Reveal All which adds a layer mask to our existing layer. The layer now contains a second box, this is the transparency channel for our layer.

tutorials/photoshop/layers.jpgTo make this mask work to our desired effect, we need to add a black and white gradient to our document. Let’s restore Photoshop to it’s default color mode by pressing the CTRL-D keyboard shortcut. This will ensure our colors are black and white. Select the gradient tool (tutorials/photoshop/texttoolicon.jpg) and apply it from the bottom of your text up, until you get the desired effect.

You can use this simple reflective text method on images or graphics as well as text and it’s a great way to learn basic web type standards.

Download the Photoshop File