Edmonds Commerce : Web Development, Design, SEO

Archive for February, 2008

Saving a File or Webpage using PHP

Thursday, February 28th, 2008

Sometimes you want your PHP script to grab a text file or other external resource and save it locally.

Here is my simple function for doing just that.

PHP:
  1. function save_external_resource($resource, $filename){
  2. $data = fopen($resource, 'r');
  3. file_put_contents($filename, $data);
  4. }

You can save any kind of resource from anywhere on the web that you have access to and save it locally.

For large files you may need to edit your php.ini and increase the resource limits and max execution time.

Using cURL with XAMPP

Wednesday, February 27th, 2008

If you have read through this blog, you will realise that I am a big fan of the cURL library for PHP. Also, when using windows to code - I like to use the XAMPP package to give me easy access to an Apache, PHP and MySQL stack.

So here is my quick guide to getting XAMPP to work with cURL. Its really easy:

1. Navigate to your root XAMPP folder

2. Search for all files and folder with this search query: php*.ini

3. Open up all of the files in your favourite windows text editor (try notepad++)

4. Do a find and replace: Find ;extension=php_curl.dll and replace with extension=php_curl.dll (you are just removing the semi colon). Make sure you select to replace in all opened documents

5. File -> Save All Documents

6. Restart Apache using the XAMPP control panel

Thats it - enjoy using cURL.

Related Blogs

http://www.vladimirated.com/web-development-how-to-enable-curl-on-xampp-for-win32

http://www.tildemark.com/programming/php/enable-curl-with-xampp-on-windows-xp.html

http://www.menyhart.net/blog/developer-stuff/enabling-curl-on-xampp/

http://incoherentbabble.com/2007/04/21/using-curl-in-xampp/

http://gabrieljones.com/getting-curl-to-work-in-xampp/

http://rovani.net/weblog/?p=19

Favourite Firefox Extensions

Tuesday, February 26th, 2008

Firefox is awesome. The thing that really makes it awesome is the fact that it is very easy to customize it to have all the functionality you could dream of. The way that firefox does this is by allowing you to install add-ons. These little additions to the program bring extra functionality to firefox.

Here's a list of my current favourites in no particular order:

SEO for Firefox

ColorZilla

Web Developer Toolbar

Live HTTP Headers

Google Toolbar

Ad Block Plus

Prefbar

Plain Text to Link

Here are some Other Favourite Firefox Addon Blogs
http://booststrapping.typepad.com/booststrapping/2007/05/top_firefox_add.html
http://www.noinham.info/e-commerce/nhung-firefox-plug-in-huu-ich-cho-web-design/
http://chris.pirillo.com/2008/01/08/favorite-firefox-extensions/
http://mouseblog.wordpress.com/2008/01/23/extend-your-firefox/
http://blogs.lib.umanitoba.ca/carol/2007/04/my_favourite_addons_for_firefo.html
http://www.technologyevangelist.com/2006/11/googlepedia_my_favor.html
http://gratemedia.com/fluentinmumble/2007/11/15/favorite-firefox-extensions/
http://mp.blogs.com/mp/2005/05/on_my_favorite_.html
http://librarianinblack.typepad.com/librarianinblack/2008/02/sarahs-top-ten.html
http://flyinghamster.com/blog/2006/10/31/favorite-firefox-extension/

Developing Web Applications in Windows

Tuesday, February 26th, 2008

My favourite platform for web development has to be Ubuntu Linux. As a desktop system to work on (rather than play) I think it is unsurpassed. However there are some times that you really need to use windows. For example my laptop seems to refuse to install Ubuntu which means that I am forced to stick with windows XP for the time being. However windows can be a perfectly adequate web development environment.

One of the trickiest aspects of web development on windows used to be setting up the Apache, MySQL and PHP stack. However this is no longer the case thanks to the wonderful little package called XAMPP. This is short for XP, Apache, MySQL, PHP and Perl.

Xampp allows you to run a webserver on your local computer. This allows for superfast editing and checking of your web application. Anyone who has repeatededly edited and FTP'ed a file to a webserver will know that it can quickly become a pain and definitely slows down your performance as a programmer.

By editing the file locally and simply refreshing your web browser you can quickly see how your web design is looking or ensure that your PHP is not throwing any errors etc.

Furthermore, using XAMPP allows you to start and stop the entire web server stack easily from one simple control panel.

Download XAMPP from here 

Ecommerce Back Office Optimisations

Monday, February 25th, 2008

Its easy sometimes to focus entirely on the front end features of your web site or ecommerce business. Without a doubt the front end is the most imporant part of your web site as it needs to work well to allow your visitors to find and purchase what they are looking for.

However, the back end of your ecommerce site also needs some investment putting into it. A well designed and implemented back end will mean that your customers get better customer services and your staff are happier and therefore more cheerful and better at making your customers happy.

A well designed back office system will have the utmost automation built in, which means that your staff costs are lower and the capacity for human error to upset the flow of your business is minimised. Naturally it is the most mundane and boring tasks which are the most ripe for automation. This means that your staff are happier as they can concentrate on the tasks that really do require a human mind to be dealt with effectively.

The other major aspect of a well designed back end system is easily accessible and relevant information. This means that if your customer services operative takes a call from a customer who is chasing up an order, your operative can be looking at all of the relevant information within a couple of seconds, and can quickly determine the current status and advise the customer with accurate and up to date information.

It also means that as a manager, you can have access to performance indicators and other management information just as easily. This will allow you to quickly spot and diagnose problems and take action to fix current problems and prevent future problems.

All of this means a better bottom line.

If you would like to get some help with your ecommerce back office, get in touch today.

osCommerce Essential Modifications

Thursday, February 21st, 2008

osCommerce is an awesome ecommerce package. It has many critics and this is mainly due to the fact that unlike many modern open source packages it is not really ready to run "out of the box". That is a drawback, however it is not really so much of a drawback when you take into account that anyone that would want to establish an ecommerce presence is going to be very keen to modify the package to make the site look and feel unique.

This is where osCommerce really shines as it is very easy to modify and there is a huge user base with literally thousands of plugin modifications or "contributions" in osCommerce speak which can help you to make your store work in exactly the way you want.

There are some things though that are highly recommened for every osCommerce store though:

1. Search Engine Optimisation

As standard, osCommerce really is not very search engine friendly. Search engine friendliness is the first step towards search engine optimisation. This of course means that there are a fair few things you need to do to your store to make it truly search engine optimised. However, they are worth the hassle (especially if you get us to do it for you) and once you have some SEO modifications implemented, you will be able to start to get indexed and gaining visitors from the search engines without having to pay per click.

2. Speed

There are a few key things that every store should really do to speed up osCommerce. If however you expect your store to have a lot of visitors and/or display a lot of products and categories then you will really benefit from giving the front end of the site a bit of an overhaul in certain areas. The speed improvements possible are really quite dramatic and can make the difference between your visitors sailing through the site straight to the page or product they want or them getting bogged down, bored and finally leaving before they even get where they want to be.

3. Security

osCommerce is pretty secure out of the box. The admin side obviously needs some password protection and can be made more secure if it is felt neccessary. An easy modification is to simply rename the admin folder into something that only you know.

4. User Friendly

The osCommerce ecommerce system is fairly user friendly from the outset. One area that many people prefer to modify though is the checkout procedure which can be a bit long winded for some.

5. Easy Administration

Admin side there is a whole host of things that you can do to make your and your employees' lives easier. For example adding products one by one using the admin tool can be a bit tedious and slow. Easypopulate is an awesome addition to any osCommerce store allowing easy population and editing of the product catalogue using your favourite spreadsheet program. We like Open Office for this task.

Part of the joy of running your own web site is that you are free to edit, change, personalise and improve it to your hearts content. Some things you will add because they make a real difference to your bottom line and some things you will add just because you think its a good idea or will be cool. The great thing with osCommerce is that you can edit it and make it work the way you want.

If you are not confident with PHP or the change you want to make is a bit more complex than you can handle, then we are more than happy to get in there and give you a hand!

Running Internet Explorer under Ubuntu Linux

Tuesday, February 19th, 2008

Ubuntu Linux is undoubtedly the most successful desktop version of linux available today. It has managed to tempt across many dedicated windows users with its easy installation procedure, comprehensive bundle of applications including open office and firefox, its greater security and reduced vulnerability to internet viruses and malware. And of course the fact that it is free to download and install.

For a web designer, it is nice to have a sleek desktop environment to code in whilst being able to run a full LAMP stack web server as the localhost - meaning that designing and developing web sites is a breeze.

However, there are times when you simply need to check that a design is going to work with Internet Explorer. Microsoft's Internet Explorer web browser is bundled with windows and is therefore the most popular web browser at the moment. However as a web designer it causes problems as it often behaves erratically or unexpectedly. For this reason a web designer always needs to make sure that they check their designs in Internet Explorer.

Another reason that Ubuntu users may need to use Internet Explorer is to log into certain sites which are not compatible with anything other than Internet Explorer. This is a real pet hate as it is real sign of laziness on the part of the web designers not to ensure that their web sites are accessible by all web browsers. Unfortunately the sites that tend to be like this are the ones that you really need, such as online banking sites. Its probably something to do with sloppy handling of ssl secure and insecure content, but I am not sure on that one.

Anyway - to save you having to maintain a windows installation and reboot everytime you need to check something in Internet Explorer - there is the excellent IEs 4 Linux package. This great package allows you to easily install Internet Explorer under Ubuntu (or any other version of Linux).

You need to have WINE installed and working, and also have the cabextractor working. Both of these packages are available in the syntaptic package manager in Ubuntu.

Related Resources

http://novicenotes.net/2006/08/04/ie_on_linux_wine/

http://blog.taragana.com/index.php/archive/how-to-run-microsoft-internet-explorer-7-6-55-51-in-linux

http://alternativenayk.wordpress.com/2006/11/27/internet-explorer-on-linux-help-for-xfld-ubuntu/

http://www.liewcf.com/blog/archives/2006/04/install-internet-explorer-6-on-linux

SEO, Links, Pagrank and Anchor Text

Tuesday, February 19th, 2008

One of the most important aspects of a successful SEO campaign is the building of links from external web sites that point to your web site. However it is not as simple as that. There are good links and bad links. If it was as simple as building the most amount of links possible then it would be very easy for those of us with a little bit of know how to completely dominate the search engine results pages.

No these days you need to build quality inbound links that are from reputable web pages. The links must not have the rel="nofollow" attribute as if they do they will effectively be worthless to you in terms of SEO. The no follow attribute was brought in to try and combat the explosion of blog comment spam. The idea being that if blogs are set up to automatically nofollow all links posted in comments then the spammer might give up.

What Makes a Good Link? 

A good link will firstly be from a page that is relevant to the page that you are trying to promote. So lets say for example you are trying to build links to your category page where you display your range of rabbit hutches and other rabbit related paraphenalia, then ideally you want to be building links on other web pages that are also rabbit related.

You might decide to take Google's toolbar pagerank into consideration when you are looking for inbound links. Whilst this is by no means a reliable indicator of the value of a link, it does give you some indication and I think it would be fair to say that a link from a page with a pagerank of 4 or more is much better than a link with no pagerank.

The other major factor that you need to take into consideration is the anchor text of the link that you place. The anchor text is the visible text that people can actually click on to visit your page. To promote your rabbit products page, you really want to try to get the word rabbit in there. So for example <a href="mysite.com/rabbit-page.html">Buy Rabbit Stuff</a> is much better than <a href="mysite.com/rabbit-page.html">click here</a>.

Where to Build Links?

This is the big question and unfortunatley there are no easy answers. Various link building oppportunities tend to crop up, be over exploited and then become generally worthless, or much reduced in value. Where to build links really depends on the context that you are trying to build links for.

If you would like to hire Edmonds Commerce for some link building services or consultation - drop us a line!

Who Needs Photoshop? PHP GD Images and Your Online Store

Monday, February 18th, 2008

Many web masters will be familiar with Photoshop by Adobe. This highly featured photo editing and graphics application is incredibly powerful, but also incredibly expensive. If you find that the main thing you do with photoshop is basic product image cropping, resizing, trimming, rotating and watermarking then there is a better way!

If your server uses PHP and has GD functionality enabled, you can use the power of the GD library to automatically do all of these things for you. Furthermore the GD library is faster than using photoshop and as the process actually runs on your server, you do not have to worry about uploading files. Your employees can directly manipulate product photos from your web store administration screens.

Chances are the main thing you will need to do is to take one hi res source image and create one or more resized versions of it to be displayed as thumbnails or product info page images. Your Hi Res images can then be displayed as a pop up or lightbox.

There are many PHP GD thumbnail classes etc out there and you will easily find one by searching the major search engines.

Here are the basic concepts though:

1. Grab an image into memory from an external jpeg file
Before we can do anything we have to get an image into the memory. This then gives us something to work with.

PHP:
  1. //grab image into memory,  $img = full url to jpeg image
  2. if(!$jpeg = imagecreatefromjpeg($img)){
  3. <h2 style="color: red">Failed to Grab Image ' . $img . '</h2>
  4. ';
  5. }

2. Manipulate Image however you want
There are all kinds of things you can do with the image you have loaded using the GD library.

3. Display the Image or Save to Disk
Once you have manipulated the image and have it looking the way you want, you can either serve it up or save it to the disk. Of course you can also do both if you prefer.

PHP:
  1. //save image
  2. $save_path = 'Your Save Path';
  3. imagejpeg($jpeg,$save_path);
  4.  
  5. //display image
  6. header ("Content-Type: image/jpeg");
  7. imagejpeg($jpeg);
  8.  
  9. //destroy image to free memory
  10. imagedestroy($jpeg);

Related Resources
http://uk3.php.net/gd
http://www.phpclasses.org/browse/package/1365.html
http://www.phpit.net/article/image-manipulation-php-gd-part1/

Essential Search Engine Optimisation Research Tool

Saturday, February 16th, 2008

A large part of an effective SEO campaign involves researching the current top ranking sites for your chosen key words or phrases and then trying to figure out what they are doing to get there. This can be a painstaking and laborious task. However there is one great tool which is highly recommended to give you a quick insight into the SEO factors contributing to a particular web sites ranking.

SEO for Firefox is an addon for firefox which does a few things. Firstly it can give you information displayed directly onto the search engine results pages. However this can seriously slow down your browsing experience depending on how many bits of SEO info you want to be displayed automatically, how many results you view in one page and of course how fast your internet connection and PC are.

Another neat feature of the SEO for firefox plugin is that it highlights any nofollow links on whichever page you are looking at in red. This is a useful feature which means you don't have to read through source code to check for the nofollow attribute.

The final great feature is built into the right click menu. This allows you to open up a full report of whichever page you are looking at in a new window. I find this feature the most useful on a day to day basis as it is non invasive, but allows you to easily get the information you want on demand.

Definitely worth installing and playing around with, though by no means a substitute for proper investigation, the SEO for Firefox addon is a must for any web master or online marketing professional.