Archive for the ‘PHP’ Category.

A PhpWeather PhpWiki plugin

PhpWiki:ReiniUrban added the [PHP Weather][] plugin code from PhpWiki:CarstenKlapp. It was on PhpWikiDemo:enPhpWeather for some time but never in CVS.

Here is a test of the [PHP Weather][] plugin:

<?plugin PhpWeather icao="EKAH" language="en" ?>

It shows how the weather is where I live.

PHP Weather is moving…

PHP Weather It’s been a while since my last post — I’ve been busy. One of the things I’ve been working on is [PHP Weather][]. And the cool thing is that I’m not alone: Max Hammond has helped me a lot. He has made the beautiful logos you see here and on http://phpweather.net — he also bought the new short address.

One of the cool new things is the updated Configuration Builder which helps you build a correct configuration file.

The framework is actually usable for other projects as well if it is adapted a bit. It works by presenting some options to the user. The input is checked at the client using JavaScript and at the server by PHP. Depending on the input more options might appear — this is controlled by the options dependencies on other options. The idea is, that the user wont be asked to fill in a database-password unless he has selected a database-type that requires a password.

So, things are moving in the right direction — you should come and join us if you want to help. There’s plenty to do: if you cannot code, then perhaps you’ll be able to go through the comments in the code and correct some of the more embarrassing spelling errors I’ve made :-)

A Printer-friendly Version of the tutorial

I’ve finally made a Printer-friendly Version of my PHP Tutorial. I’m sure, that some would say that it was about time :-) The page is build from the actual pages that make up the tutorial, so it will always stay current — it’s actually pretty cool.

Making documentation for PHP Weather

I’ve been playing a lot lately with a lot of exciting technologies, such as XML. I wanted to produce some nice documentation for PHP Weather. I then thought of Docbook. But I’ve never used Docbook before — I hardly knew what it was.

So I tried writing a little, and I produced both

HTML and PDF files. But it looks awful! The lines are not justified, the font used is Times, etc. Compared with LaTeX I didn’t like it. I know that I can change these things, and I did manage to change the font to Palatino, but it still didn’t look “right”.

So I set out to try and use the XML-files produced by PHPDoc to make code for LaTeX. First I tried using a XSLT stylesheet to transform the XML code. That worked a little, but it wasn’t powerful enough — you can do some simple things, but not nearly enough.

So I then decided to do it myself with the aid of PHP. At first I had a really hard time figuring out how to parse the data properly. PHP can parse XML, but you’re only given three events to react on: open-tags, character-data, and close-tags. You have to do the rest… But I managed to find a solution, so now I have a nice script called phpdoc2latex.php that does what it says it does: converts XML files produced with PHPDoc into LaTeX code. You can see the result in the CVS repository.

As you can see, I’ve added some extras to the doc-comments :-) The really nice graphs are made with an amazing program called Dot from the Graphviz package.

So many releases…

Yesterday I made two new releases of PHP Weather. The stable version now includes a Hungarian translation donated by Gyulai Mihály. That brings the total number of translations up to 11.

The unstable version has also been improved. It’s now possible to get a list of countries and a list of stations in a specific country, so that it’s easy to make pages like the ones you find at the NWS Internet Weather Source. All the database backends can do this — even the ‘null’ database. So this means that things should work right out of the box.

The output has also been changed, so that it’s more correct now. Instead of saying things like light showers of rain it now says showers of light rain. The problem is that showers can’t be light because it’s a descriptor. It’s only rain that can be light because it’s a form of precipitation. (I didn’t figure this out myself — Thanks goes to Johnny Funder for this information.)