Capable SEO

How to do PHP While Loops

Now that you know how to use if then statements lets move on to a basic loop.

  1. Lets get started by opening your favorite editor and starting a fresh source page. Start off with the basic coding which denotes a php area. <?php ?>
  2. Now lets add in a variable and an echo statement. Give one variable a value of 0 then echo it.
    <?php
    $x
    =0;
    echo
    $x;
    ?>

    This should print out 0.

    PHP generally starts many constructs at 0, not at 1 so its generally better to start counting from 0 in programming..

  3. Now lets add in a basic loop. The while statement is very similar to an if statement except a while loop will do the things as long as its conditions are met (or until timeout which is generally 3-5 minutes depending on your server settings).
    <?php
    while (/*requirements*/)
    {
    //Stuff to do
    }
    ?>

    This won’t print anything yet

  4. Now lets make that actually do something. We’ll have it run 5 times, so while $x<5 do something. Of course we have to increase $x inside the loop otherwise it won’t end. So the only action we have right now is adding one to $x, we can do this with $x=$x+1; or in english x is equal to x +1.
    <?php
    $x
    =0;
    while (
    $x<5)
    {
    $x=$x+1;
    }
    ?>

    This won’t print anything yet

  5. Now lets add on an echo so we can see the progress of $x counting up towards 5.
    <?php
    $x
    =0;
    while (
    $x<5)
    {
    echo
    $x;
    $x=$x+1;
    }
    ?>

    This should print out “12345

  6. Ok now there is a better way to add one to $x and thats a special operation which is coded like this ++$x;
  7. Now lets add some text to each echo so it looks a bit nicer. You can print a variable and letters by using an echo with quotes. so in this statement echo “x: $x”; the first x will simply be the letter x and the second one which is preceded by a $ will be the variable.
    <?php
    $x
    =0;
    while (
    $x<5)
    {
    echo
    "x=$x";
    ++
    $x;
    }
    ?>

    This should print out “x: 1x: 2x: 3x: 4x: 5
    Now this doesn’t look much nicer (actually it looks worse!), but we’ll fix that in the next step.

  8. A PHP echo will place code directly into the html of a file. So if you type html code into the echo you can use different html functions to change displays. In this way you can make things bold, manipulate css styles etc. For now we’ll just add a <br> to the end of each line this will make the numbers go to different lines.
    <?php
    $x
    =0;
    while (
    $x<5)
    {
    echo
    "x=$x<br>";
    ++
    $x;
    }
    ?>

    This should print out:
    x: 1
    x: 2
    x: 3
    x: 4
    x: 5

Basics of Link Building

When considering the process of getting your site ranking highly on web search engines, the first thing most people will tell you is to develop your incoming links. To that end, there are a few things you should know first:

  • What is link building?
  • Why is link building important?
  • Where can I build my links?
  • Can I buy links?

What is link building?

Link building is, in short, the process of building links to your site in order to increase traffic and rankings in search engines. There are a number of ways to do this, including getting your site listed in directories, developing a network of similar niche sites, promoting your site commercially through some well-known media sources, or even simply having your friends and family link back to your site from their own. The key to this is developing quality, natural links (i.e. not listing your site on rubbish link farms that search engines tend to overlook or using other dubious link building methods such as spam to promote your site on the web).

Why is link building important?

In today’s fast-paced, niche-centered web, ranking high on a search engine for specific keywords or phrases is important to attract the hundreds of millions of people around the world who use the internet daily to come to your website. To do this your site needs to be seen by search engines as having relevance to a particular searcher’s needs when they look for specific words or phrases. Making these search engines see your site as being relevant will help boost your ranking in search engine results and increase your traffic. The most effective way to boost your ranking is for other websites to link back to yours. When this occurs it is essentially a vote by Site A (the site linking in) to Site B (your site). The more votes a site has, the more relevant it is seen by search engines to suit their particular customer’s needs. The more powerful the site is casting the vote (such as .gov, .edu, or other well established sites) the more powerful the incoming link is.

Where can I build my links?

There are a number of different ways that you can build your links. As mentioned earlier, some of these can even be your close friends and family that may have their own websites that may be similar to your own. The key here is those last four words: similar to your own. Many times people ignore this part and develop links from rubbish link farms that are ignored by most SERPs and contribute no value to your site. Make sure that any links that you generate are also followed. If a link has the “nofollow” attribute attached to it then it does not contribute to your site’s rankings. SEO Book has some useful tools for Firefox users that can allow you to check these and other website information such as Page Rank (again, still a bit important, but not the end-all, be-all in today’s SEO world) as you browse. Simply sign up for free and you can gain access to them.

Submit your sites to specialized directories as well. Many new directories open each day and offer site submission for free to get their directory off the ground. These can be found in many forums around the internet, so keep your eyes peeled. You can also try submitting your site to DMOZ, a very large user-run directory that many other directories draw off of.

Just remember, try and keep your backlinks focused and quality. Quantity may be good, but not if they’re not contributing at all to your website.

Can I buy links?

The simple answer is “Yes, you can, though it’s not encouraged.” You can search the web and find many individuals or companies out there that are willing to sell links from their sites back to yours. Sometimes this can possibly help give your site a large boost to its rank. It’s encouraged not to do this, however, as many search engines tend to see this as an attempt to boost your ranking via money rather than actual relevance to users. Currently many search engines such as Google and Yahoo! have advanced search algorithms in place and are constantly updating them to find and discount paid links to sites in order to create a more balanced, fair experience for their users.

Basics of Critical Website Components

There are a few key components that are critical to optimizing a site:

  1. Titles, URLs and Other Meta Information
  2. Site Accessibility
  3. Site Layout

Titles, URLs and Other Meta Information

Some of the most over-looked aspects of websites, these three items play important roles in search engines determining the overall relevancy of your site and, in turn, your ranking. Properly using title tags (H1, H2 etc.) for example helps search engine spiders determine what key information exists on the page and allow you to target keyword phrases that may help you drive traffic to specific sections of your website. This can be coupled with proper meta information (meta tags and descriptions) that search engines can use to help track information within a page. While it may be true that meta descriptions may not play as much of a role in search engine results now as they did in the past they can still help drive traffic to your site if the description is relevant and increases click-throughs.

Good looking URLs can also play a good role in attracting and retaining visitors as well as helping you rank in search engines by increasing the keywords on page. Compare the two following examples:

Sony mylo Internet Devices

http://www.sonystyle.com/webapp/wcs/stores/servlet/CategoryDisplay?catalogId=10551&storeId=10151&langId=-1&categoryId=3711&SR=nav:shop:mp3_portable_elec:personal_communicators:ss&ref=http%3A//www.sony.com/index.php

Wal-Mart’s In-Store Free Samples and Trials

http://instoresnow.walmart.com/In-Stores-Now-Free-Samples-And-Trials.aspx

In the first example the long string of text in the URL is a dynamic URL that, while it may be useful for database queries, is not very user friendly. At a quick glance the website visitor does not know what page they are on nor could a search engine easily determine the relevance of this page to a user. In the second example, the URL is clearly laid out and is easy for a user to determine exactly where they are on the page and navigate accordingly. This is important to plan your site for from the beginning a site re-work later on to correct this can be both quite costly and time consuming.

Site Accessibility

Make sure that your site is fully accessible and working at all times. This means no broken links, no missing pages, no server downtime, and appropriate file sizes for each of your files. From a site visitor standpoint this means that your site is appealing to all visitors, they can easily load all items, and they can have an enjoyable experience on your site. From a search engine standpoint, excessive loading times can actually cause search engines to not index some pages on your site, while broken links may also stop some indexing from occurring. Should this happen your site may not fully rank for what you are targeting and as such your traffic will suffer significantly.
Make sure that all of your site content is accessible to search engines as well. Text and other items in picture format, for example, can not be searched for by engines and as such if it is not attributes a proper alt text you may lose traffic on key areas.

Site Layout

Finally, ensure that your site layout is managed properly in order to allow for both users and search engines to access all information on your site quickly and effectively. Information should never be buried more than two clicks away from your home page (or three clicks, in the case of larger websites). This helps ensure that the information is readily accessible to your viewers and helps ensure that all pages are indexed appropriately in all search engines. You can also make use of a sitemap and 301 redirects to make sure users and search engine spiders are directed to the proper location on your site rather than lost in outdated information. Finally, as a rule of thumb, make sure all information located on the website is laid out from broad/general information down to specific ideas. This both helps website visitors to locate information they are interested in as well as inform search engines that your site is highly relevant and on topic.

View previous post in Basics of SEO series, Basics of Keyword Research

Basics of How Search Engines Work

Search engines work with a number of different algorithms that can be referred to as “spiders” that search or “crawl” the web for sites that are relevant to specified keywords users input. While these algorithms become quite complicated and look at a number of different aspects of websites there are a few key components that search engine spiders look for in their searches. Some of the important factors for search engines are:

  • Links
  • Content
  • On-Page Factors

Links

When one site links to another on the web this could be seen by a search engine spider as a vote for that website. In short, if site A links to site B, that is essentially a vote by site A for site B. The more links that come in to a site the more the site is seen as valuable content that may benefit a user. The larger power the site has that casts the initial vote (site A in my example) the more value the incoming link has overall.

Content

Content also plays an important factor for websites. Websites that have content that matches closely to specified search terms allows customers of search engines to have better user experiences. Search engines consider sites with high quality content to have more authority on a topic, just as individual consumers would go to the most experienced or knowledgeable professional for advice or quality service. The more authority a site has, the more relevant it is considered to be to a customer’s search query to satisfy the customer’s needs for the search.

On-Page Factors

There are a number of on-page factors that play important roles in search engine ranking of sites. Sites with good page titles and headers that relate to specified search terms, for example, tend to carry more weight than pages where titles and headers are unrelated to search terms yet their content is. Proper usage of H1, H2 and even H3 headers that relate to targeted search terms in web pages can help bolster web page ranking than those who simply describe the subject in their content.

Complex Algorithms to Combat Spam

In each of these areas search engines are constantly waging a war against link spammers that post links on a wide range of sites attempting to increase their relevancy to particular terms. Some website developers use this to their advantage to gather ranking in search engines and drive more traffic. To counter these rubbish links search engines are regularly developing more and more complex algorithms (with thousands of factors that affect search engine results) to search the web, ignoring or eliminating these shady websites.

View previous post in Basics of SEO series, What is Search Engine Optimization (SEO)?

View next post in Basics of SEO series, Basics of Keyword Research

Basics of Keyword Research

Selecting the proper keywords to target can be considered the most important step in getting your site to rank in all major search engines. Without targeting the proper keywords to match your intended target you could easily lose great amounts of traffic or rank in unrelated areas that people would rarely see that would hurt your website and possibly your business as well. To that end, there are a few basic steps you should go through when determining the proper keywords to focus on in your website development:

  1. Idea Generation
  2. Visitor/Customer Research
  3. Keyword Research
  4. Performance Tracking

1. Idea Generation

Consider all possibilities of what your site’s visitors or potential visitors will be looking for when searching online for information. This is a general brainstorming time and not one to rule out items. These could be single words, short phrases, or even longer, more specific phrases that would have strong relevance to your site and what you are offering.

2. Visitor/Customer Research

If your site has been up for some time research into what the visitors like. Do they tend to go to one particular area on your website? Do they generally come to your site by using particular search terms? Even a free program for tracking visitor’s like Google’s Analytics can be of help in this.

Haven’t had a site for long but you’ve have had a business operating for quite some time? Do the same research you would conduct online into your customers by reviewing purchase logs, conducting surveys, reviewing historical records…any records you may have for your customers that you have been using over the years to adjust your business should be considered targets you should look at.

Once you have gathered information from your customer research you can then begin eliminating some of the words or phrases you generated in your Idea Generation stage and move to the next stage in your research.

3. Keyword Research

Now that you have a few basic keywords to look for, do some research into each and find out its benefit to you. Using some easily accessible tools such as Google’s Adwords Keyword Tool you can find out how often internet users search for particular terms and see what may be most relevant to you. If you are an online dog toy company, for example, people regularly search for the term “dog toys” according to Google’s tool roughly 301,000 times a month, while a focus on “buy dog toys” gets roughly 590 searches a month. The number of searches for the second term may be less, however at the same time the searches for this term would most likely generate better leads to your site and would increase your sales revenues over someone looking for a more general term.

You also need to research into what your customer’s intent is when searching for a particular search term. In my previous example, if I search for the term “dog toys” my goal may not be to buy dog toys but to simple see what dog toys are out there. Maybe I am even looking for examples of ways to design my own dog toys at home. The phrase “buy dog toys”, however, is much more specific and it is reasonable to assume that if I were to search for these terms I would be a potential customer.

As you research into the various keywords always bear in mind “what is the searcher’s intent in looking for these words?” and “how will my site satisfy that need?”

4. Performance Tracking

Once you have established your key terms and begin working them into your website continue tracking your site’s traffic for those terms. Regularly check your traffic sources and terms being searched for and adjust your site accordingly. This can focus your site to meet visitor demands, increase your ranking and conversions, and ultimately increase your site’s profitability overall.

View previous post in Basics of SEO series, Basics of How Search Engines Work

View next post in Basics of SEO series, Basics of Critical Website Components

What is Search Engine Optimization (SEO)?

Search Engine Optimization, commonly referred to as SEO, is the application of effective design and content management techniques to drive traffic to a website via natural or “organic” traffic from search engine providers. These providers are typically engines such as Google, Yahoo, MSN (and now Bing, Microsoft’s newest search engine) Ask, and AOL (powered by Google), with a few other search engines making up a fraction of the other online traffic.

When using a search engine the more relevant a website is to the specified search query the higher it ranks on a page. For example, a website selling various automobile parts may be listed somewhere in the 464 million search results on Google for the keyword “cars”, however websites dealing with cars specifically (such as cars.com or cars.gov) are generally seen on the first page of the search results.

Search engines provide results for users based upon complex calculations or algorithms that are designed to apply information retrieval (or IR) processes to their immense databases of websites to determine which websites best match the user’s search criteria and display the results in descending order, beginning with the most relevant search and ranking downward from there. With over 182 million websites existing today effective IR processes are important to provide searchers with exactly what they intend to search for.

SEO is the process of improving websites to increase their relevancy to specific search teams and increase the ranking a site has in search results. The higher the ranking, the more likely the site is to receive traffic from web searches. Applying SEO to a website can help make a website more accessible to search engine IR processes and, in turn, increase its rank and profits.

View next post in Basics of SEO series, Basics of How Search Engines Work

If Then Math PHP Statements

  1. Lets get started by opening your favorite editor and starting a fresh source page. Start off with the basic coding which denotes a php area. <?php ?>
  2. Now lets add in some basic variables and an echo statement. Give two variables a value of 2, and a third variable a value equal to the previous to variables added together.
    <?php
    $x
    =2;
    $y=2;
    $number=$x+$y;
    echo
    $number;
    ?>

    This should print out 4 .

  3. Try changing the + to different mathmatical operators these are:
    / Divide
    * Multiply
    - Subtract
  4. Now we’re going to add in an if then statement. Basically if statements are logical, if certain requirements are met then do something. An if then statement looks like this
    <?php
    if (/*requirements*/)
    {
    //Stuff to do
    }
    ?>

    The if statement is one of the few that doesn’t require a ; after it.

  5. Now lets a simple statement that says, ‘if’ ‘$number is not equal to four’ ‘echo Thats not Four’. This code looks like this.
    <?php
    $x
    =1;
    $y=2;
    $number=$x+$y;

    if ($number!=4)
    {
    echo
    "Thats not Four";
    }
    ?>

    This should print out “Thats not Four

    The comparison operators in PHP are as follows:
    != Is not equal to
    == Equal to
    > Greater than
    < Less than
    >= Greater than or Equal to
    <= Greater than or Equal to

  6. Now lets say you want to check if the number is between 5 and 10. You’ll need to use two checks in the if instead of one. So you need to say ‘if’ ‘$number is greater than or equal to 5 and less than or equal to 10′ ‘echo number is between 5 and 10′. The code for this looks like this:
    <?php
    $x
    =1;
    $y=2;
    $number=$x+$y;

    if ($number>=5 && $number<=10)
    {
    echo
    "number is between 5 and 10";
    }
    ?>

    This shouldn’t print anything

    Logical Operators for PHP
    && and
    || or

  7. Now this is fine and all except what, happens when your number doesn’t fit the criteria? Nothing happens. So lets add on the final part of an If Then statement. So now PHP will go if $number is between 5-10 do this, or else do this. The code looks like this:
    <?php
    $x
    =1;
    $y=2;
    $number=$x+$y;

    if ($number>=5 && $number<=10)
    {
    echo
    "number is between 5 and 10";
    }
    else
    {
    echo
    "number is less then 5 or greater than 10";
    }
    ?>

    This should print number is less then 5 or greater than 10

Capable SEO