Archive for the ‘Development’ Category

Adding XML processing to the websites

Although I’ve been running database driven websites for a couple of years now what I’ve not done before is to access other peoples’ sites from my own until now.

A common way to offer people access to corporate databases via the Internet is by way of providing an XML feed. What’s XML? Well, it’s a way of holding offering both the data and the data structures via a webpage. It looks a little bit like normal HTML in that it uses the <angle> brackets but other than that it’s completely different.

The problem is that it’s a very general purpose format and not tied to any particular language. In my case, the site that I wanted to access provided examples in ASP but I use PHP so they weren’t a whole lot of use to me. Neither as it turns out was the big book on XML that I’d bought to get me on the road with the development.

However, as always there’s a lot of help around on the Internet if you look in the right places. After a few abortive attempts I found the PHP routine clsParseXML which provides a very simple yet powerful interface to XML data. Essentially what it does is to read the XML file and return it in an array or rather an array of arrays.

The database I wanted to access is essentially one large structured list of place names around the world each of which have a list of diffent accommodation at them. So, first of all I had to read the entry which listed all the regions ie Africa, Asia, Europe, etc., then choose the code for the region I was looking for and run the query again to get the countries in that region, and so on down to counties. Within the lowest level there’s a link to properties in that area requiring a whole new qyery.

Sounds very complicated, doesn’t it? Actually, it’s very simple and the high level queries run to only a few lines of code:

  • region_id=get_region_id(“0″,”Europe”);
  • region_id=get_region_id(region_id,”France”);
  • region_id=get_region_id(region_id,”Languedoc-Roussillon”);
  • region_id=get_region_id(region_id,”Pyrenees Orientale”);

Which gets me a region_id for the properties in the Pyrenees Orientale. With that I call another routine to scan through the properties in that region and return an array containing all the information of properties there.

With that, I was able to run up the HTML to integrate the properties on the external database with those from my own database thus giving, for example, the Languedoc-Roussillon page where the only way to identify the properties from the external database is by the “VR” prefix to their reference numbers.

How long to complete? Well, I started yesterday afternoon and had the test version running in a couple of hours with the live version completed in under an hour this morning. However, in reality it took much less than that as a lot of the time went in looking for that critical routine to read XML into a PHP array.

The game plan was to roll out this development to my sites listing properties around Europe but unfortunately the external database isn’t structured in the same way as my own outside France so I’ll need to run up some code to translate between the two structures first.

Copyright © 2004-2014 by Foreign Perspectives. All rights reserved.

Website technology upgrading

When you’re plugging away on your own with a bunch of websites, it’s easy to fall into the trap of not keeping things up to date. After all, the websites are doing quite nicely, so why bother messing with them?

Thankfully, I have a friend who runs a smaller stable of websites who acts as the competitive spur for me and, sometimes, I for him. For instance, I was quite happy with the adsense income that I was getting ’til I heard how much he was getting so I started working out why he was getting lots more and ended up having quite a jump in income from that source as a result.

Where we differ is that his sites are more general travel guides whereas mine are more concentrated in the accommodation listing area which means that it was fairly simple for him to slip in affiliate links supplying accommodation listings to his sites but it’s much more difficult for me. Or, at least I thought so. He’s moved on to his second generation version of integrating the accommodation feeds into his sites which looks like being a lot easier than I had expected it to be.

Sooo, I’m just about to start work on the “second generation” integration level that he’s already using which should ultimately let me popular my sites in most of the countries around the world.

Funnily enough, it will be simpler for me to do that integration as my little stable is database driven whereas his are hand written pages for the most part. This means that adding one bit of code to a single page will be enough to populate all of the pages of each series of sites that I apply it to. Now, “all” I need to do is to get that one bit of code written and working!

Copyright © 2004-2014 by Foreign Perspectives. All rights reserved.

More changing over

It took ages but I’ve finally got the images for the listings sites uploaded to the new host and the domains that I’ve transferred seem to be operational too.

That leaves me with about half a dozen domains to do today to complete the move of the listings sites. They’re the simple ones so there shouldn’t be any problem in moving them over.

Next up are the blogs and the directory which are a little more complex in that they both use databases. There’s a surprising number of photos in the blog too but nothing like the amount that the listings sites use.

Once they’re over, I’ll be able to delete the databases from 1and1 and downgrade my hosting plan which’ll save something like £10/month as the only pre-database plan I needed was all of £25/year. That’s actually the biggest problem with the charging structure on 1and1 – if you need a database then you’re immediately looking at a jump from a reasonable £25/year up to £10/month.

Copyright © 2004-2014 by Foreign Perspectives. All rights reserved.

Still a very low takeup for the free B&B listings in Northern Ireland

I was a bit taken aback by the very high takeup from our e-mail to Scottish B&Bs and self-catering places a couple of weeks ago. So many took it up in fact that I’m going to have to implement a redesign of the site for Scotland that I’d not planned on doing ’til next year at the earliest.

So, I figured that the takeup would be broadly similar in Northern Ireland. Yet, although I’ve mailed a similar number of places (allowing for NI being smaller), the takeup is only about 10% of that for Scotland. Less than that actually as I’m still getting new entries for Scotland from the e-mail of a few weeks ago.

The wording is identical too so I’ve no idea why the takeup should be so abysmally low: lower even than the notional 1% that I should have received.

Copyright © 2004-2014 by Foreign Perspectives. All rights reserved.

The Stumbleupon effect

I’ve been “hit” yet again by StumbleUpon for a post in the same subject area ie on The France Show.

As before, there are the usual hundreds of hits and diddly in terms of adsense income from them as, on the whole, StumbleUpon people tend to be looking for something fairly specific (which is pretty ironic given the nature of it, of course).

What I keep meaning to do is to use StumbleUpon in some way as I feel sure that there must be some way to keep the arrivals on the site in some way. So far though I’ve not sat down and done more than think a little about it.

Ideas welcome!

Copyright © 2004-2014 by Foreign Perspectives. All rights reserved.
Archives