Websites/Bogs

You are currently browsing the archive for the Websites/Bogs category.

In my SEO & Web Marketing series of articles I outlined many things to take into consideration when designing your web pages and websites. One thing about website design that I haven’t covered yet is the underlying server software that is used (if any), such as PHP or Lasso or ASP, to assemble your web page before it is sent from the server to the browser. I’ll be covering that in an upcoming article.

In this article I will be discussing why it is important to think down the road and make a plan. One thing you have to remember is be flexible as time goes on as your website may take another path than you had intended.

I have this client who wanted a web page put up, yesterday. We all know someone like that. We discussed what they wanted to do with the site and where they wanted it to go. The monkey wrench was that it had to be done yesterday. So, to please this client I opted out of doing any programming and put up the page (which is all they wanted at the time) using straight HTML and CSS.

They recently came to me and said they want this page with this information and that page with that information and so on with more pages coming down the road. If you have never done a website – maintenance on two or thee html pages is nothing. When you get to ten or more with new pages being added it gets to be a problem if you have only them in html because you have to update menus on ten or more pages.

When I was in boot camp, my C.O. had this saying – “Prior Positive Planning Prevents Piss Poor Performance.” Benjamin Franklin is reputed to have said “If I had six hours to chop down a tree, I’d spend the first four sharpening the axe.” That should be fairly self explanatory, but if it isn’t allow me to elucidate: Take the time now to review my Web Marketing series and get a road map.

Now back to my story.

I knew that I would need to do some programming on this site – if nothing else, to make it easier for upkeep. Yet I listened to my client and put it up quick. If I had stuck to my guns a little more – or did the programming off the clock – it would have been a snap to update. As it stands now, I will have to recreate the page as a template and create the new pages and update the index page. Added time for me (has pluses and minus’) and added – unnecessary –  expense for my client.

So learn vicariously on this one and it could save you a lot of headaches in the future.

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Offline Marketing

Back in the mid 1990′s, I read a book by Jay Conrad Levinson called “Guerilla Marketing.” It was and still is a fascinating read. After reading the book I got a client needing help with their internet presence which included stabilizing the web server (it was really flaky) and marketing. I thought fantastic! I could really put Jays’ advice to the test as the company was only about 9 months old and grossing only $20,000 in that first year with 6 employees.

After 6 months the owner was looking to do an IPO (initial public offering – stock market terminology) and 6 months after my contract expired they netted $2 million. A couple of years later they were purchased by another company.

I did this using a combination of traditional advertising and the concepts in the “Guerilla Marketing” book. Since the book was written he has penned many other books to help the aspiring entrepreneur achieve their goals.

Often overlooked by website owners, off-line marketing can provide a big boost to your site’s activity. The object of marketing is to keep your business, product or service in front of the public. There are many ways to market your web site off-line. Some of these are free, some are inexpensive and some require a fair-sized expenditure.

Standard Fare

If you are a business, you will need all the basics: letterhead, envelopes, business cards, printed business forms, etc. If you only have a personal page, you might consider “business” cards at the very least.

Business cards are really inexpensive so buy a lot and pass them out. Put them up on community bulletin boards. Visit book stores and insert them into magazines and books relating to the topic of your site (you didn\’t hear that here, OK?) Leave them on bus seats or your table when you go out to eat.

You should also consider flyers, brochures and mailers. You can create and produce these yourself. However, having them professionally done is usually worth the extra expense, but not always. Consult your business plan/road map to see if that is the way you want to go.

Pass these items out or mail them to anyone who shows an interest in what you are doing. In future contacts with these people, give them additional copies to pass along if they don\’t need them anymore.

In your emails make sure you have a link to your site in your signature.

Organizations

There are many organizations available that you can use to get the word out. You may want to consider your local Chamber of Commerce (CoC) or Merchant Association, professional and trade organizations, guilds and so forth. There is usually a list of these organizations in your phone book or at your local library. These groups are often looking for information that might be of interest to their members. Be aware that they may charge a fee or ask for a donation or sponsorship. You may want to consider joining some of these organizations.

Use these organizations for “networking.” The people you meet may pass your information on to others who may be interested. You better your chances of making “qualified” contacts the more people you meet. Keep a contact file of these people and make notes to refer to later.

Traditional Media and Sponsorships

Never leave out the local media (newspapers, radio, television). They are always looking for items of local interest. Write a press release, find out whom to send it to and get it to them! Some media may be willing to work a deal exchanging advertising.

Sponsoring local events is another way to get media coverage for your business. Look at what is happening in your area. Track down who the main contact is and ask them how to become a sponsor.

Consider becoming a contributing “writer” for a local newspaper, magazine or radio station. If you manage to become a contributor, tell your friends and family and have them help spread the word.

Consider advertising in conjunction with other businesses (split the cost). This is often called co-op advertising.

You can also use direct mail (junk mail; don’t sigh as this is highly effective), coupon mailers and response card packs as well. They typically yield a 1-2% response rate which is just about average for advertising in general.

Friends, Family and Co-Workers

Other sources often overlooked are friends, family and co-workers. Ask them to put some of your business cards in their wallet or purse to pass on to their friends. Ask them to also talk about your website every chance they get (but make sure they don’t try to “hype” your site.)

Basically what you need to do is build your “street cred,” also known as credibility. This actually applies to offline as well as online marketing.

More SEO & Web Marketing

Content; the KISS Theory (“Keep It Simple, Seriously”) 

Adobe Flash, Bells and Whistles

Planning Considerations

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Tags: ,

Now we get down to actually starting to set the page itself up for SEO. A lot of people involved in Search Engine Optimization will poo-poo the following and try to ignore developing what I am going to cover in this article saying “Search Engines don’t pay attention to these any more.” That is partially correct. The algorithms (analysis process) they are using today are much more sophisticated than they were even five years ago. What this means is that if your <meta> tags or <img> description tags are not relevant to the content on the page they will be ignored.

You see, back in the day (mid to late 1990′s), people tried all sorts of, what would be called “Black Hat SEO” today, tricks to get top rankings. The search engines picked up on this and changed their analysis to eliminate these tricks. If you weren’t on the internet then, just trust me, it was really annoying.

However, so far, this website – yourwebreference.com – currently ranks in the top 15% of the sites quantified by Quantcast and in the top 7% of the sites they track. All I have done is to use the html tags properly (we are XHTML and CSS validated by the W3C.) Well, that and providing good, interesting content.

Meta Tags

Meta Tags, <meta> when you look at the code, (specifically the description and keyword tags) are extremely important for search engines and should be devoted to only to a particular page – some overlapping with other pages is ok. For the most part they should be reflective of the page content – not the site. Don’t use inappropriate words to get people to your site.

The description tag should provide a brief relevant description of the page itself – a summary if you will. You should use no more than 100 words. Search engines will truncate your description to meet their requirements.

The keyword tag is used for relevant words that will help people find your site. Use multiple word phrases if you can. You can use up to about 14 “keywords.” More than that may be considered spamming and may give you lower search engine rankings. Unless it is impossible without them, try to avoid using words and phrases that are generic. Use common misspellings (e.g.. Cannon for Canon) as well.

Watch your web logs to see how people are finding your site and adjust your keywords appropriately.

Heading Tags

Heading tags indicate relative importance of the text on the page. Use them as much as possible. If you do not like how they appear, you can change them using Cascading Style Sheets (CSS). Most search engines use the heading tags to help determine the ranking of your page. Beware though that you should only use one <h1> tag. They break the content into logical sections.

Content

Content is what it is all about. Try to make your content unique. Don’t use “canned” material unless that is all you have to work with. To keep people coming back, change your content often or keep adding pages.

Images

Make sure that you provide descriptions of your images within the <img> tag. This description should describe the image – briefly. It seems that search engines are starting to give higher ranking to sites that are working toward WAI standards (Web Accessibility.)

Links

Links are the lifeblood of the internet. Give the links titles. This may seem counter-intuitive but it, like the description for the <img> tag above is a step toward WAI. Link tags are denoted by <a>.

Lists

Ordered and un-ordered lists are a way of setting important information into a brief but highly readable format. Use them when you can as they set a special look to important information. The tags used are: <ul> (unordered list) for a list using bullets or <ol> (ordered list) for a list using numbers or letters then each item in the list uses <li> for list item.

By way of example consider recipes:

  • The ingredients could use an unordered list
  • The recipe steps would use an ordered list because you don’t want to put the ingredients in the oven before they are mixed.

If you are developing your own website be sure to learn what information can be used with each tag and use it. If you are letting someone else do your website, tell them to use titles or descriptions for any tag that uses them.

This information is still very basic but will build a solid foundation for future growth of your website.

More SEO & Marketing:

Adobe Flash, Bells and Whistles

Content

Planning Considerations

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Tags: ,

Flash, Quicktime and Plug-ins

Adobe Flash is dead. Quicktime, RealPlayer and others are finally being relegated to their proper roles. This has come about because of CSS3 (Cascading Style Sheets Layer 3) which, when fully implemented by all the browsers will take your web surfing experience to the next level.

The World Wide Web has come a long way since its’ inception. We now have interactivity (blogs, forums, mutli-user games, etc.) The average user can now download pages ten times (or more) as fast compared to just a few years ago.

But with these technical changes the users have changed as well. They expect more faster. So, no matter what, you still need to make decisions regarding file sizes and how much cutting edge technology to use to get your message across.

Most sites don’t need whiz-bang-gee-aint-that-nice effects like Flash Animations or Quicktime Presentations. If you decide to use animation and video on your site, make sure the content is appropriate for your site. Keep them to a minimum or put each one on its own page. You still need to keep the file size as small as possible.

Thanks to YouTube, Flash has made great strides and is now a de-facto web standard. As such its’ use on the web has exploded and works extremely well on most bowsers and platforms. However, with the coming of CSS3, and the iPhone not adopting it, it has recently become a de- de-facto standard.

One of the problems with Adobe Flash is that search engines CAN’T index any text inside the video, so DON’T do a Flash website. If you feel the need for Flash keep to just presentations. Don’t use Flash website templates.

Be cautious of new or proprietary technology as it may limit your visitor base. An example would be that Microsoft decided many years to no longer develop a windows media player for platforms other than Windows.

JavaScript is a popular way to add special effects. Be aware that all browsers handle JavaScript differently. This was true back in the 1990′s and is still true today although it is being supported better and more consistently by all browsers. So be sure to check it in as many of the major browsers on as many platforms as possible. CSS3 has many, but not all of the abilities that Javascript/JQuery has in regards to image and text manipulation.

Plug-ins enhance your web browser and can enhance your browsing experience. Don’t use them unless you need to. With all the security problems these days, people do not want to put more on their computers than they have to. If you feel you need to use them, see if you can use the more popular plug-ins like QuickTime or RealPlayer first.

Basically ask yourself – “Does my site need this?” If you answer no or maybe, don’t do it.

More on SEO & Web Marketing:

Planning Considerations

SEO Options

Page SEO Options

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Tags: , ,

The KISS theory (“Keep It Simple, Seriously”).

The design and layout should reflect your business, but don’t go overboard or people will not come back.

Things to consider are:

  • Do not design your site for a screen larger than the most common screen size. As of today large screens or high resolution has become the standard, with the exception of smart phones, but this can be remedied through the use of CSS (Cascading Style Sheets).
  • Too many colors will be too confusing (unless the designer is very, very good). Backgrounds are usually best when they are a single color or muted graphic or picture. If you want a picture or graphic as your background, make sure that the text will be easily readable over the entire graphic.
  • While frames are neat and sometimes useful, they can make it very tough on search engines when they try to index your site.
  • If you have more than one page, you will need a navigation system that is easy to use. While graphical is nice, simple text navigation works just as well and is easier to change if you tweak your design or colors.
  • Pictures and graphics can take a plain vanilla site and turn it into a tutti-frutti one. Unless your site is about pictures and graphics, don’t let them outweigh your text. I used to say keep them to a minimum. Four or five 20KB-25KB graphic files are sufficient. With the advent of high speed internet you can use more but still keep them small in file size (low 2 digit kilobytes). The pictures and graphics should be pertinent to and complimentary of your site.
  • Content is still king. It always will be. Use text pertinent to your topic for the page.
  • Page height should be no more than two to two and one-half screens in height with less scrolling better. Ideally, a page should be less than two screens in height.
  • Content should have the most relevant information near the top. Break the content into logical groups and place these groups on separate pages. Don’t make too many pages or your visitors may lose interest. Use your keywords in the body of your text, the file name, the page name and the description which is used by search engines.

Be aware that each browser displays HTML in a different way

Although they are getting closer to actually adhering to W3C standards. Microsofts’ Internet Explorer is the worst offender and has been since it hit the web. Even as such it still holds a significant share of the browser market (depends upon whose statistics you use.) For the sites I manage I have seen it drop from 80% to around 40%.

Try other browsers such as Safari or Firefox for a better web browsing experience.

Feel free to add a comment about any other W3C compliant web browser that you use and enjoy and feel that our readers may want to know about.

More articles on SEO & Web Marketing:

Be Smart When Designing Your Website

SEO & Web Marketing – Planning Considerations

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Tags: , , , , ,

You can design your web site yourself or hire a developer. It is easy to create a page or site and not too hard to create a good-looking one. Creating an effective site is not at all easy.

You, or whoever you hire to develop your website, will need to look at what you came up with in first 2 parts of this series as this will greatly impact the structure and delivery of your website.

Those two steps determine the needs of your site, as well as what you need in a server, server software and the “bandwidth” of your servers connection to the internet. They will also help you determine what you need in the way of a developer.

There are many website developers available and they are not all equal. Some are very good at handling the basics while others are better at designing custom solutions using cutting-edge technology. Some are better at graphics while others are better at working with databases.

Can a developer handle your current needs? What about your possible future needs or desires? What is their customer service like? Are their customers happy?

Just because a firm has few customers, or has few employees (like Ed-WebDesign), does not mean they are not qualified to design your page or site. Ask questions. Dig into their philosophy. Get to know them. You may like them, but, can they do what you need?

Can they do your site within your budget and timeframe? Quite a few developers I know tend to overbook and underestimate. So be careful, it can make a world of difference.

Do your research and make your plan.

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Tags: , ,

When you decide you want a web site, there are many items to consider. Any answer to each of the questions below have both positive and negative ramifications. This is just a basic list of considerations, and some positive or negative results of various answers to the questions, when thinking about putting a site on the web.

Will it be a personal site or business site?

If you are doing a personal site you have a world of creativity available to you with fewer downfalls as a result of those choices than a busness would. This creativity can make designing the website take longer as you discover new “cool” looks.

If it is a business site, in general, you cannot be as creative. The internet has matured quite a bit since the wild and wooly days of the 1990′s and early 2000′s. As a result of this increased maturity the people on the internet have let businesses know what works for them – things such as ease of navigation (easy to find links that help them get around the site) and basic structure (where on the web page they will look, and expect, different things to be).  This can actually make the designing of the website faster.

Will you need a basic storefront for a business, a catalog site, or a full e-commerce site?

  • A basic storefront could be considered as a fancy business card for your business. It is a simple page that provides the who, what, when, where, why and how of your business.
  • A catalog site allows a visitor the ability to browse your wares and/or search for specific items or items that meet specific needs. This is very much like someone browsing a print catalog at home.
  • A full blown e-commerce is probably the closest you can come to having a “physical” presence on the web – exclusive of virtual reality. You can have shopping carts, real-time interactive customer service/ sales associates available via online chat sessions, order tracking and more. The downside to this is that it CAN take a considerable amount of time and money to get it all set up – especially if it is a custom solution.

Will you do your own developing, or have someone else do it for you?

If you decide to do your own development, or have someone in your business do it for you, it can save you a lot of money, but it can also take longer to do. It can provide you with a lot of satisfaction but it can also look unfinished.

With a professional doing it for you, it may cost you quite a bit but it will look finished and get finished quicker.

Will you have a directory on another server, a subdomain or a full domain?

When I started with the web back in the mid 1990′s a domain name lease – you don\’t actually own the domain name – cost $1,000 per year. This was a major consideration on how people would type your website into the address bar of the web browser (e.g. mydomain.com vs. mysite.ahost.com or ahost.com/mysite.) Today it isn’t much of a concern as domain names can be had for about $10.00 per year.

Having said that it still has an impact whether you have a domain name or not.

Having a domain name basically allows you to say this is my island in the sea of information known as the world wide web. It is easier to remember, however, it is getting tougher to find a good domain name for a couple of reasons: 1) the sheer number of sites on the web, and 2) cybersquatters (people who buy domain names in the hope that they can “sell” them at a profit.

Using subdomains can save the expense of registering a domain name. It can also say “Hey! I’m part of a cool community” just like  at younglivingcircle.com or wordpress.com. It also eliminates the need for a domain name altogether because subdomain names do not need to be registered as it is considered part of the domain that is registered such as wisemanoils.younglivingcircle.com is part of younglivingcircle.com.

Will you be managing your own server or will your site be hosted?

Managing a site (meaning server hardware, server software as well as managing all the files that comprise your website) can be a full time job unto itself. It requires continuous monitoring to ensure that it is running and running right as well as taking care of security holes. Most people do not opt to host a site themselves, which is usually a wise move. Having said that if anything goes wrong, if you know what you are doing, you can get your site back online in a matter of minutes.

If you will be paying to have the site hosted someone else is responsible for all of that and more. Can you say double edged sword? That strength is also its weakness in that you are relying on someone somewhere else (usually hundreds of miles away or more) to do it for you. If anything goes wrong you must rely on them to sort it out and fix it – hosting systems are very complex and it could take a while.

Who will host your site?

If you decide to have someone else host your site look at them very closely. Do they have something that meets your needs in your target price  range? Do you need unlimited storage or bandwidth? How reliable are they?

I recently moved some sites from one host to another because the old host had some major issues. Issues such as ftp connections dropping and not being able to restart them, they were restoring from a backup files that were months and many versions out of date (the kicker that made me move the sites), DNS issues and many other smaller issues. Their uptime was great, their customer services was good but those issues made me say enough.

How will it tie in with your current marketing? Will you need to make changes?

When it comes down to it there basically two ways of approaching anything short term and long term. A website is a long term object, especially when it comes to maintaining a presence on the web. You shouldn’t change it to suit a whim because visitors will get used to how things are presented or how things work and a change can be more than they are willing do deal with.

I have a client that decided to move away from wordpress.com because they made some changes on the back end that really put this person out. Personally I could understand – the colors changed , the layout changed and some of what you had to click on to get to certain things changed. They really liked wordpress so we decided that self hosting wordpress where the upgrading could be controlled and access to workings of the wordpress application gave us the opportunity to mitigate any egregious problems.

If it is for a business, how will the site tie in with your regular business?

Ultimately this is the question. This is the why of the whole deal. Why do you want a website?

Do your research and make your plan.

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Tags: , , ,

Recently while I was doing some research for a new web application I was looking for a simple and clean, almost zen-like way to create alternating rows of color in a table. Interestingly this problem was not connected with the website I was creating.

As I was scouring the web I came across a multitude solutions, that while they may work, were just way too complex for my taste. I read a quote in a signature on a forum a while back that said “Code is poetry.” With the exception of regular expressions, that is what I try to do with my code – but I try to take it one step further and try to achieve what might be the haiku equivalent in code (simple, direct and can be understood by even novices to the art.)

All the while in the back of my head MOD kept circulating, so to refresh my memory, I did some research on it. All I could find was something to the effect of “MOD returns the whole the remainder after a division.”   Hmmm, not specific enough. So I set up a spreadsheet, ran a bunch of mod calculations, and immediately saw something interesting – repeating patterns! I knew I found the answer to my alternating row problem.

Let’s start with some basics of math:

  1. Anything divided by zero is undefined (there isn’t any answer)
  2. Zero divided by anything is, well, zero
  3. Anything divided by 1 is that number

A couple of basics about MOD:

  1. 0 MOD anything is zero (see #2 above)
  2. Anything MOD 1 is zero (e.g. 12 divided by 1 is 12 with zero left over, 123 divide by 1 is 123 with zero remaining)

So, what does MOD do exactly? In grade school when learning to do division at first we never got into decimals (.1, .14159256, etc) in the division process. So, if we divided 12 by 7 the results were 1 with a remainder of 5. MOD returns the remainder, which in this case is 5. That’s it. That’s all that MOD does.

How did this solve my dilemma? Well, after seeing the patterns in my spreadsheet, I realized the pattern generated by MOD could be used by telling me which line to color for the table row. I was using PHP and MySQL for the project, but the solution as is could be used for ASP, JSP, Java, C, C++ or any other language just by changing the syntax. Here is the pattern for a simple 2 color alternating row:

  • Row 1 MOD 2 (since I was looking to do just 2 alternating rows) is 1
  • Row 2 MOD 2 is 0
  • Row 3 MOD 2 is 1
  • Row 4 MOD 2 is 0
  • Row 5 MOD 2 is 1, etc

The results of MOD 2 is binary (meaning only 2 numbers, or if you like states). It is either one or the other.

So, xMODy has y possible numbers, or states, ranging from 0 to y-1 ocurring in a repetitive patern. For example: xMOD7 has 7 possible numbers ranging from 0 to 7-1=>6 (e.g. 0, 1, 2, 3, 4, 5, 6, 0, 1, 2…)

This translated into – if “Row number MOD 2 is 0 set the table row color to color 1 else set it to color 2.” Which is the solution I was looking for.

Now to translate it into some thing more significant: (like an outline for a coding language)

Set a counter to 1 //FOR THE FIRST ROW

Start your loop

if the counter MOD 2 equals 0 do something else do something else

increment counter

End the loop

That is the logic behind how I solved my problem. For example if I wanted to alternate white and pink as background rows in a database driven table, the syntax of PHP it would look something like this:

<table>

<?php

$tr_alt_background = "style=\\"background-color:pink;\\""; //DEFINES THE CSS STYLE FOR THE OFF COLOR BACKGROUND

$alt_row = 1; // COUNTER

do { ?>

<tr <?php if ($alt_row%2 != 0) {echo $tr_alt_background;} $alt_row++; ?> height="35px"> //HERE IS WHERE THE MOD COMES IN

<td width="147" colspan="2" style="padding-left:30px; font-size:16px; font-weight:bold; width:350px">

<?php if ($row_From_Table[\'table_column_1\'] == 1) {echo "<img src=\\"images/active.png\\" />";}

else {echo "<img src=\\"images/not-active.png\\" />";} ?>&nbsp;&nbsp;<?php echo $row_From_Table[\'table_column_2\']; ?>

</td>

</tr>

<?php } while ($row_SUbDomain_List = mysql_fetch_assoc($SUbDomain_List)); ?>

</table>

That was my solution, it is not as tidy as I would like, but it is easy enough to figure out how it works if I hadn’t explained it.  Note that in PHP MOD is represented by the % sign.

Now if you wanted to get even fancier, say alternate blue and pink rows with a dark border every 4th row you could define the styles in an array and call the style by using the value returned by the MOD function. Since the divisor also tells us how many states we can have we will need 4 definitions, some of which could actually be empty. So it could look something like this:

$divisor = 4; // SETS THE COUNTER LIMIT - IS EQUAL TO THE NUMBER OF CHANGES POSSIBLE

$alt_row = 0;  // IN THIS EXAMPLE WE MUST START WITH ZERO BECAUSE MOD'S SMALLEST VALUE IS ZERO

$alt_array[0]="style=\\"background-color: blue;\\"";

$alt_array[1]="style=\\"background-color: pink;\\"";

$alt_array[2]=$alt_array[0];  //SINCE THIS STYLE IS ALREADY DEFINED NO NEED TO RETYPE IT ALL AGAIN

$alt_array[3]="style=\\"background-color: pink; border-bottom: 3px solid black;\\"";  // THIS LINE HAS THE CSS DEFINITION FOR THE BLACK BOTTOM BORDER

<table>...<LOOP>

<tr <?php echo $alt_array[$alt_row]; $alt_row++;  ?> >...<tr>

…if ($alt_row == $divisor) {$alt_row = 0;} // RIGHT BEFORE THE END OF THE LOOP TAG

</LOOP>...</table>

Aside from defining the styles this method uses only 3 short lines of code to create a table of alternating color with a dark separator every fourth row. In PHP the end of a line is indicated by a semi-colon, so, defining the variable $alt_row is one, echo $alt_array[$alt_row] is 2 and incrementing $alt_row ($alt_row++) is 3. Very, very haiku.

This same code can be used for any HTML tag that is going to be repeated in a database driven loop. You could even use it to set the class tags by defining the classes in your CSS and then defining $alt_array[x] = “class=\\”stylex\\”";.

# # #

Curt SitersCurt Siters

Webmaster

Shoals Creek Village - a new build intentional community.

My Eco Oasis - the hub for what will be a network of many ecovillages.

Big fan of living simply

Look deep into nature, and then you will understand everything better.  ~Albert Einstein

Man's heart away from nature becomes hard.  ~Standing Bear

Tags: , ,