Monthly Archives: January 2012

CSV Export Using PHP’s Output Buffer

Creating the CSV file without using adding/deleting a file on the server’s file system. This involves the use of the PHP output buffer. In the case of a CSV file, they are being created by the PHP script on the fly, adding the data that you want to export on a row-by-row basis. For this we need to:

1) create a file handle
2) fputcsv each row into the file
3) send the entire thing to the browser to be downloaded

Here is the code:

header("Content-type: text/csv");
header("Cache-Control: no-store, no-cache");
header('Content-Disposition: attachment; filename="filename.csv"');

$outstream = fopen("php://output",'w');

foreach( $myArray as $row ) {
	fputcsv($outstream, $row, ',', '"');


$myArray is an array of records just the same as you would find in a database (the same thing that will appear in the new, downloaded CSV file). Notice that there is no file being created on the server.

Helpful tip:

Just relying on the extension doesn’t work, even in Windows. The magic is in the third header setting, “Content-Disposition,” which informs the browser to download as a separate file
~ from


Cross-browser Testing Old Versions of IE on Mac

I run a Mac and for all of my web development work and for years had used any old PC that I could get my hands on for my cross browser / cross platform testing for my HTML, CSS, and Javascript work.

I had always been under the impression that, even though I was running IE9 on Windows 7 through my VM Ware Fusion software and could just do my IE9 testing right on my Mac, that I still had to keep that old PC around for my older versions of the browser.

One day not too long ago I stumbled across a solution that I didn’t even know was available to me.  Moreover, I already had it in place and didn’t even know it. Internet Explorer 9 has this functionality built right into it.

On any copy of IE9, click on the “Tools” icon in the upper-right corner of the browser and look for the selection that says: “F12 Developer Tools”.

When you click on that you will either get a split window in your browser that shows both your website view along with the resources available to you in the developer tools app; or, yours will show up in an entirely new window all to itself.

When the Developer Tools window appears, look through the main menu for the “Browser Mode” drop down menu.

There you have it. All the late-model IE testing that your little heart can handle right in one place.

WordPress query_posts() References

Some good reference pages for WordPress’ query_posts() functionality.

WordPress function reference ->

Quick overview of what it does ->

Always to be used with wp_reset_query(). ->

query_posts() is the easiest way to alter the default query that WordPress uses to display posts. Use query_posts() to display different posts than those that would normally show up at a specific URL.

It is not only used to display different posts than what is displayed by standard functionality, it can be used to display WordPress posts in different order. Example: display pages or a post category that contains posts that do not follow a typical blog layout (ex: a listing books or authors in alphabetical order).

Google Plus: Benefits for SEO

I came across the following three articles this week regarding the emerging SEO benefits of establishing an active business presence in Google Plus.

They do a good job of explaining the significance of Google Plus and its corresponding relationship to Google Search Plus. Here are some of their significant points.

What is Google Search Plus?

Google Search Plus Your World** is the next evolutionary step in determining what is relevant to personalized search queries in that individuals search results are greatly influenced by their circles of friends.

** Google Search Plus: personalized results from your contacts – which may be images, shared posts, or pages that have been given a +1 by your contacts; or even pages on Google+ that you may not be connected to.

The output is search results that display/promote People and (business) Pages in Google+.

Why is Google Plus important for my website?

The most significant reason to get your business on Google+ is simple: The quality and corresponding engagement around your search engine visibility stands to either noticeably improve or gradually decline.

At the heart of this lies the new “Search Plus Your World” algorithm (also referred to as “Search+”), which relies on data collected from logged in Google+ users. The output is search results that display/promote People and (business) Pages in Google+.

Like Facebook, you’ll see updates from those you follow (Circle) in Google+. But unlike Facebook, the content in your Google+ posts may turn into highly ranked search results on Google (again, inside or outside the Google+ environment) – providing keyword and topic-relevant search engine visibility that improves based on your “AuthorRank” and content-specific engagement levels.

Screen Shot 2012-01-25 at 7.34.04 AM

Google Analytics Alternatives

In an article published this week, Search Engine Watch gives a nice overview of alternative website analytics solutions to using Google Analytics.

While Google Analytics has its own set of merits, there are drawbacks. Many people don’t want to continue to feed Google more data – and this trend is growing.

The solutions are comprised of Hosted Solutions (hosted somewhere else for you) and Self-Hosted Solutions (hosted by you).

Alternatives mentioned:

Here is a link to the article.

Screen Shot 2012-01-25 at 7.17.37 AM

Balance Website Ads with Content

In an announcement this week, Google said that they will be tweaking their search algorithym to make things more strict for website publishers who have an excessive number of ads on their websites. This doesn’t mean all websites with ads will be demoted in the search engine results; it just means that there should be a balance and they [Google] are planning on being more strict about it.

In an informative article about the topic, does a great job of explaining the change.

Another article on the topic from Ebay’s Partner Network Blog.