Archive for the 'Online' Category

 

TinyMCE broken

Wednesday, September 17th, 2008 in Online, PHP

If WordPress’ visual editor TinyMCE stops working after you have edited the config file tiny_mce_config.php and begins droping error messages telling you “Cannot modify header information - headers already sent”, make sure the config file doesn’t start with a byte-order mark (e. g. 0xEF 0xBB 0xBF). It seems Windows Notepad writes these bytes to the file if you edit and save it with Notepad.

To get TinyMCE running again, get a fresh copy of the config file and overwrite your flawed one with it. If you need to edit the config file try a different editor. WordPad did the job for me. Just to make sure you are not running into the same problem again, check the edited file with a hex editor of your choice and see that it’s not starting with EF BB BF.

WordPress Zooomr Manager

Monday, September 8th, 2008 in Online, PHP, Photos

When Zooomr released it’s API to the public earlier this summer, I hoped someone would use it to add Zooomr support to WordPress. This topic became important again, when my brother began to fill up our precious webspace with more and more photos. I recommended Zooomr to him as a hosting service for his pictures, but since he’s not that much of a techie, I started thinking about an easier way to add Zooomr photos to WordPress articles than looking up the photo URLs by hand at Zooomr. This is how I found Trent Gardner’s great WordPress Flickr Manager – a plugin for just this purpose. Unfortunately the plugin is focussed on Flickr as you can guess by the name.

So I had to rewrite some of the code to match it Zooomr’s API and to my honest surprise it worked quite well. The plugin reached sort of a first stable alpha and although not all features supported by WordPress Flickr Manager are working, the most important of them do. This is a feature matrix of WordPress Zooomr Manager:

Application authentification working
Inserting photos into posts working
JS Lightbox viewer working
Sorting by smart sets working
Managing your photos in WordPress working
Plugin options working
Uploading photos to Zooomr untested
Inserting photos sets untested
JS Highslide viewer untested
Tag search not working
Changing image size buggy
Internationalization unsupported
Labels changed from “Flickr” to “Zooomr” nah

Because I’m a bit short of spare time right now, I’m gonna release the modified plugin in it’s current state. I’d LOVE to see someone improve it or – even better – integrate both Flickr and Zooomr support into Trent’s WordPress Flickr Manager. If you need further information on the modified code or the Zooomr API, I will happily provide it for you as far as I can.

WordPress Zooomr Manager

Download WordPress Zooomr Manager

Even more feeds

Friday, July 25th, 2008 in Online, PHP

Like I promised to my brother, I started working on a news feed for the marketplace of jzr-threewheeler.de. Contrary to my expectations the problem in this case was not so much the caching mechanism I had to implement. I had done that before and could reuse most of the code. What took me so long was the fact, that the marketplace page seems to be created and updated manually – resulting in an chaotic structure of both content and HTML. While containing over 181 000 lines only about 1 200 of them contain more than whitespaces actually. The content doesn’t follow any strict rule either. All this made it quite complex to write a good parser to process the information into a nice (and valid) feed.

Well, I managed to get it done and here it is:
http://threewheeler.feeds.kochs-online.net/jzr-threewheeler.xml

I hadn’t finished the work on this, when Adrian came up with the next task for me. He wanted to have a news feed to follow all recent posts at simsonforum.de. This was a way easier job to accomplish. Message board software does follow strict rules when compiling the pages so parsing them is quite easy because you don’t need to take all kinds of exceptions into account. So a set of simple rules is sufficient to process all the data. Using the board’s search function my PHP script downloads a list of all recently changed threads and generates the feed based on it. Because this produces quite heavy load on both involved servers (the forum’s and mine) results are cached for at least an hour before an update is made – another script using the caching code. :)

You can find this feed here:
http://simsonforum.feeds.kochs-online.net/simsonforum.xml

Lomax in da Feed

Thursday, July 10th, 2008 in Online, PHP

Again I have written a parser to create a RSS feed. Adrian told me about how much he’d appreciate a feed to follow all newly advertised Lomax kit cars over at the second-hand market of lomax-club.de. As is so often the case with pre-web-2.0 sites there wasn’t a feed available, so I sat down and made one. Et voilà - there it is: http://lomax.feeds.kochs-online.net/lomax.xml

I tried to make it as compliant as possible, but lacking most of the sellers/buyers e-mail addresses and being reluctant to publish mine to all those spambots out there, the feed isn’t completely valid. Maybe I’ll come up with a solution to that problem someday.

An optional “items=” URI query string may be used to define the maximum number of feed entries to be generated.

Frollein Kuttner’s Feed

Saturday, July 5th, 2008 in Online, PHP, TV

Being a longtime fan of Sarah Kuttner, I was happy to hear she’s producing a new little show these days. The announcement of “Kuttners Kleinanzeigen” was some weeks ago and I almost forgot until yesterday evening, so I checked her site to see the exact air dates of her show. Being there I visited the news section and thought about reading it more regularly. So I wanted to add the news feed to my FeedReader, but I had to discover there was no feed available.

Well, now there is. I wrote a little parser that converts all news entries into a nice, (almost) well-formed RSS 2.0 feed. You can find it under http://kuttner.feeds.kochs-online.net/kuttner.xml. Using the optional query string “items=” you can specify how many of the latest news items the feed should contain. Default is 10.

Multiple blogs with a single WordPress installation

Thursday, May 8th, 2008 in Online, PHP

When I started setting up the blogs some days ago, I began to create subdomains and subdirectories on the server where I could install WordPress. Soon I discovered, how complicated and prone to errors this procedure can be and started to think about alternatives allowing me to run several separate blogs while administrating and maintaining only a single software installation. You can find some more or less complex hacks for this floating around the net. In addition there exists a special multi user/multi blog version of WordPress called WordPress µ, but it seems it is turned mostly towards very large projects and uses a number of modifications of the original variant for this purpose. On the other hand there is an approach by Strider which is called Virtual Multiblog and looks quite feasible. However this looks a bit intricately at first glance because it seems to require an additional WordPress plugin.

Finally I discovered a very elegant way by myself: Because WordPress stores all settings of a blog – including articles, comments and users – in the MySQL tables defined in the file wp-config.php, it would be sufficient to use different configuration files depending on the used subdomain. So I modified the wp-config.php to simply evaluate the used subdomain and load a configuration based on the result. Which looks like this:

<?php
if ($_SERVER['SERVER_NAME'] == ‘blog1.example.com’)
{
require(’wp-config.blog1.php’);
}
else if ($_SERVER['SERVER_NAME'] == ‘blog2.example.com’)
{
require(’wp-config.blog2.php’);
}
?>

The files wp-config.blog1.php and wp-config.blog2.php are just standard WordPress configuration scripts without a single line of extra code. Using different prefixes for the MySQL tables it even would be sufficient to have a single database to store all blogs. As simple as it is, as low-maintenance it is too, because WordPress updates don’t overwrite the new wp-config.php or the newly created configuration files. At the same time all blogs benefit from the update, of course.

[Update: It just caught my eye, that you might run into difficulties if you are running multiple blogs with the same plugin. If an upgrade of that plugin requires an update of the plugin's database table, you have to pay attention to update all of those tables (for every blog using the plugin)!]

Multilingual blogging using WordPress

Tuesday, May 6th, 2008 in Online, PHP

As said before, I wanted to blog bilingual in English and German for quite some time. Translating my posts into Swedish as well is a bit too much effort compared to the number of potential readers, I guess. Even though it’d be a good training of my language skills. Nevertheless I would like to have the possibility to do so and therefore the new blog system should not only support bilingual, but also multilingual posts. After searching around a bit, I found the Language Switcher WordPress Plugin which allows users to create multilingual posts, categories, blogroll links, comments (!) and even more by adding some simple tags.

The installation is quite easy as well, if you follow the given instructions. A bit more of a hassle was the internationalization of the WordPress Theme Dust 3.17 I use. Every language needs to have a separate file translating all the text shown. PHP functions inside the code of themes or plugins replace this text with the translated text in a language the reader can choose. In case you have to add these functions by yourself, the Language Switcher plugin page provides instructions for this task, which allowed me to internationalize the Quotes Collection plugin you can see to the right. In a few days I’m gonna send the changed to code to the plugin’s author Srini who I already contacted last week, so he can publish an internationalized version of his great plugin.

Let’s start!

Monday, May 5th, 2008 in Online, Private

Welcome to my new blog!

After being silent since last October, I think it’s time to start blogging again. I’m taking this time gap as an opportunity to start over, which suits my life as well because I finished my diploma thesis in the meantime and so I’m not a student any longer, but in search for a job.

Creating this blog I’m putting a long planned project into pratice. The blog I used until the end of the last year was based on a system that was developed and implemented by myself. Now I’m using WordPress as a weblog publishing system. This is basically because of all the development and maintenance efforts such a system requires, if you’re trying to keep up on all fronts. The old blog lacked any search engine optimization (SEO) and to implement the multilingual support I always wanted to have, I would have had to rewrite most of the code anyway. Because all my attempts to attract some co-authors have failed, I was the only one writing for the blog and the decision to start over wasn’t too hard. So I pulled myself together after I handed in my diploma thesis and installed a bunch of blogs for the family domain I ordered back in June last year.

But now: Have some fun with it!