Archive for the ‘Code’ Category
An agreement was struck yesterday by the three main search engines (Google, Yahoo and MSN) on the adoption of a new tag to tackle canonicalisation in the SERPs.
Canonicalisation is the challenge of having multiple pages of the same page due to outdated software such as a content management system or forum. Examples of pages that out put duplicate content include:
-
Having the same content on the www and non www versions of your homepage or internal folders.
-
Printer-friendly pages
-
Forum threads with session id’s
An example of the new canonical tag which is placed in the HEAD of the page (where Title and Meta Description tags are placed) looks like this:
<link rel="canonical" href=http://www.yoursite.com/forum>
By placing the above tag in the <head> of pages with similar content, you would inform search engines that the page is a copy of the URL www.yoursite.com/forum and that all popularity and strength of any other duplicate pages should be passed on to that URL.
Previously, canonicalisation was addressed through rules placed in the .htaccess file of a domain. This tag while more manual, is much easier to understand by less techie webmasters and is a fantastic development on the part of search engines.
Official announcements by the three search engines can be found here:
Here is the code to grab Google pagerank for any website. This can be very useful in Buzz Monitoring applications or tools that measure importance of backlinks (including competitors)
Code:
<?php
?>
To activate the code and pull in PageRank, use the following:
<?php
?>
Enjoy!
Here is a php code that lets you retrieve a website’s alexa ranking, useful in web applications that measure importance of webpages (such as bespoke link popularity tools).
For this code snippet to work CURL library for php needs to be enabled on your server.
Code:
To display the Alexa ranking, use the following code :
echo alexaRank(’site.com’);
Have you added a favicon to your site? If you haven’t then this post will guide you through the simple process. But before I start, let me explain what a favicon is. A favicon is the little icon that shows up in the browser and tabs of your computer (depicted below). It can distinguish your site from the masses by adding that special touch.
So how do you go about creating your favicon? Simple, follow the following few steps:
-
Create the favicon as instructed.
-
save it to your desktop
-
upload it to the root of your site (where the index page lies)
-
In the head section of your html add the following code: <link rel=”shortcut icon” href=”/favicon.ico”>
Done! You now have your very own Favicon! Enjoy!
Last week I came across a tutorial and code for inline editing using Ajax. The reason I was looking for this sort of application was to implement a project management solution for one of my clients.
What inline editing does is allow you to edit an online document on the fly using AJAX, PHP and MYSQL. An example of this nifty solution found here: http://www.yvoschaap.com/instantedit/
Any of the fields can be edited and the editing is reflected right away in the MYSQL database.
If you have any questions about how to implement this please post here.
A special thanks to Yvo Schaap for supplying us with the code and example!