Archive for the ‘Web Development’ Category

I keep looking this up on the PHP site because I can never remember the syntax so I figured I'd add it here. A simple operator that cuts down on code and can be used inline with print statements…

<?php print "if the variable i is equal to 1 ". ($i==1 ? "message 1" : "message 2"); ?>

What does it mean? It's a simple if statement with a one line result for each option. It basically says if the variable i is equivalent to the value 1 ($i==1) then the first output "message 1" will be displayed on screen, otherwise the second output, "message 2" will be displayed. The following does the same:

<?php
print "if the variable i is equal to 1 ";
if ($i==1) {
print "message 1";
} else {
"message 2";
}
?>

As you can see the first way uses a lot less code! Why is it handy? Well I'm currently adding a column to a report for a web site. Some of their products are also displayed on eBay and they want to be able to tick a box in the stock info to tell them whether it's on eBay or not. Of course the report then says Y or N. However for faster access it's better to use 0 and 1 in the table, 1 meaning Y. So in my form I just have

print "<td>".($row['ebay']==1 ? "Y" : "N")."</td>";

Which basically says if the value is 1 then display Y else display N. Much quicker and cleaner!

You need to keep an ever watchful eye on your statistics because if you have any type of image on your site, someone will take a liking to it and often just use an external image link to pull it onto their web site. This is known as "Hot Linking" and is rife throughout the web. But with most good control panels supplied with your hosting package, you should be able to disable hotlinking and allow only a selection of sites, if any, to link to the image.

Why is this necessarily a problem?
Well basically if someone else is displaying an image on your server on their web site then they are feeding off your bandwidth. Why should you be paying to host the image and let them steal your bandwidth without permission? You can often see this through the referrers to your web site and also if your bandwidth seems higher than normal for the number of visitors you're receiving. So what to do? In cPanel there is a hotlink icon, going into this page will give you the option to enable hotlink protection. There is a box where you can add allowed web sites. Note NTL users and possibly others will not see the images displayed on your own site if you don't tick the 'allow to view image in browser' as NTL and other certain ISPs cache your site on their servers to improve speeds to the end user (well artificially improve), so in theory NTL are linking to your images and considered a hotlinker. I don't know NTL's domain to allow as ntlworld.com and ntl.com hasn't worked for me (I use NTL in Cardiff).

Often a question asked is, will it affect Google Images and other Image search engines. The answer is No. Google copies and caches your image on their own server. When you do an image search there is a thumbnail displayed. On clicking the thumbnail a larger version of the image is displayed with your site below. The thumbnail and larger images are both stored on google's web site so therefore are not hotlinking and won't be blocked. The site below is in a separate frame and is loading the page and images on your server, and again shouldn't be affected.

Remember however, if an external site still tries to link to an image when hotlinking is on, it will still create a 'hit' to your site. It will also use a small amount of bandwidth, but I would say less than 500 bytes of bandwidth is used. How to tell if it's working, either empty your cache and visit a site trying to hotlink, else look at your statistics. There are error codes often listed, and a hotlinked protected image will generate a 302 error. You can also see this in the raw logs file. Find the offending site using a Find function, and then you'll see the IP of the user, the filename of the image followed by a code which should say 302, another code number and then the offending site's web address as the referrer.

Of course if you're not so fussed on whether your images perform well in google search, then you can always rename the file and replace the linked to file with advertising for your web site "This image is the property of domain.com and is being displayed without permission". To put it politely!

In my own opinion, Google's Page Rank of a site is not worth worrying about. From what I've read, the Page Rank system is Google's opinion of the importance of your web site. This importance is measured by the quality of the content as well as the number of other sites linking to it and their importance can be a factor as well. Of course this is all hearsay and I've read contradicting reports about how, if you link to high PR sites you'll be deemed more important (anyone can link to the BBC though can't they!), others say if you link to a low PR site you'll lose some of your PR to that site. The PR of an external site linking to yours doesn't affect your PR, a high PR site linking to you increases your PR etc etc.

So taking all of this into account, how come I have a client's web site, that has now been online for about a year, have a PR of 4, when it is a Photo Gallery site, so the only content are photo titles (I gave up nagging the client to write some content) and alt attributes, and only recently has it acquired it's first link from a very hidden page on the Bristol University web site.

Yes Google has indexed the photos and it gets a few hits from the Google Image search, but that's about all. Anyone care to give a reason? After over 6 months of being online it had no backlinks, about 20 indexed pages in Google and a PR of 4.

I read, at least once a week, someone asking about the PR system. How can they improve it, someone else saying theirs is 5 and they want to up it to 6 or 7. Another client's website has a PR of 5. This has stacks backlinks, 300+ pages indexed and 3000+ visitors a day. I don't see it's PR causing it a problem at all, not that I'm saying the PR is dependent on visitor numbers and clicks through Google. But it proves a small point that the PR makes no difference to how many visitors you can expect to receive, no difference to your position in the search results page. All it seems to be is a little green bar on most people's browsers that give people a cause for concern.

Don't get me wrong, the BBC, Yahoo, Cafepress, all have a PR of 9/10 (at last check), and these are high profile sites with thousands of back links. But for any general site, in fact for any site, I wouldn't worry about it, to be perfectly honest, just ignore it.

If you do want to track the PR of a collection of sites, Digital Point offers a free tool which uses the Google API (a free key you can sign up for, details on the Digital Point site) to check the positioning for your sites on various key phrases and also tells you the site's PR, number of indexed pages and number of back links. You can add multiple sites to this list, saves time visiting every site you run and inflating your statistics ;o)

Google changed their adwords system last week. I've not really seen much difference, possibly because the 3 accounts I have running for clients are fairly quiet markets. I know of some people who have had their key phrases made inactive and told to either change their phrases or push their maximum Cost Per Click (CPC) up to almost £3! That's a lot of money for a visitor who may be a potential customer. Trouble is conversion is the hardest part. It's all very well getting people to your site, but if you're paying for them to come then you need to make sure your web site is very worthwhile to convert visitors into customers.

I'm also wondering how Google decides on the "Quality" of a keyword. Apparently the activity of your key phrase is determined by the quality and max CPC. Who decides on the quality? I presume it's an automated system using their database of all searches performed in google to compare with, along with other advertisers using the same phrases. Personally I just think it's a way for Google to decide what's more popular and push the price up on it. Why else would they 'improve' an already working system?

Of course their help pages aren't much help as only one or two have been updated and the rest still talk about the old system. Okay, don't get me wrong, I often make changes and upload to a live site without testing (with funny consequences at times!) however a company like Google surely should have updated everything in synchronisation.

I'm beginning to wonder if the Yahoo adverts will rival Google's Adwords and possibly be better. Once people realise that there are other Search Engines out there that produce far better results than Google (just like once people realise that there are far better browsers out there besides the non standards compliant MS Internet Explorer) the internet will start to be a better place, and get more interesting to boot.

Page 19 of 19« First...10«1516171819