tobias.kochs-online.net

8. Mai 2008
von Tobias
4 Kommentare

[lang_en]Multiple blogs with a single WordPress installation[/lang_en][lang_de]Mehrere Blogs mit einer einzigen WordPress-Installation[/lang_de]

[lang_en]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:[/lang_en]

[lang_de]Als ich mich dieser Tage daran begab, die Blogs einzurichten, begann ich zunächst für jedes Blog eine Subdomain und dann ein Verzeichnis auf dem Server zu erstellen, wohin ich das WordPress installierte. Dabei fiel mir schnell auf, wie umständlich und fehlerträchtig so ein Vorgehen ist und ich überlegte auf Alternativen herum, die es erlauben mehrere getrennte Blogs zu führen, während man jedoch nur eine einzelne Software-Installation administrieren und aktuell halten muss. Im Netz finden sich hierzu mehr oder minder komplexe Hacks für WordPress. Zudem gibt es eine explizite Multiuser-/Multiblog-Version von WordPress mit dem Name WordPress µ, die sich aber offensichtlich eher an sehr große Projekte wendet und entsprechende Änderungen an der zugrundeliegenden WordPress-Variante mit sich bringt. Relativ gut umsetzbar wirkt hingegen der Virtual Multiblog-Ansatz von Strider. Aber auch das erschien mir auf einen ersten schnellen Blick hin mit dem zu installierenden WordPress-Plugin als etwas zu umständlich.

Schließlich kam ich selber auf eine überaus elegante Lösung: Da WordPress alle Einstellungen eines Blogs – samt der Einträge, Kommentare und Benutzer – in den MySQL-Tabellen ablegt, die in der Datei wp-config.php angegeben sind, würde es ausreichen, abhängig von der verwendeten Subdomain verschiedene Konfigurationsdateien einzusetzen. Also habe ich die wp-config.php so modifiziert, dass sie lediglich die aufgerufene Subdomains auswertet und anhand des Ergebnisses die gewünschte Konfiguration lädt. Das sieht dann so aus:[/lang_de]

<?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');
}
?>

[lang_en]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)!][/lang_en]

[lang_de]Bei den Dateien wp-config.blog1.php und wp-config.blog2.php handelt es sich dabei um ganz normale WordPress-Konfigurationsskripte, die ohne eine Zeile Extra-Code auskommen. Verwendet man darin unterschiedliche Präfixe für die MySQL-Tabellen, so reicht sogar eine einzige Datenbank aus, um alle Blogs zu speichern. So simpel, wie das ist, ebenso pflegeleicht ist es auch, da bei einem WordPress-Update weder die neue wp-config.php noch die angelegten Konfigurationsdateien überschrieben werden. Gleichzeitig kommen natürlich alle Blogs in den Genuss des Software-Updates.

[Update: Mir fiel soeben auf, dass man Schwierigkeiten bekommen könnte, wenn man in mehreren Blogs dasselbe Plugin verwendet. Falls nun ein Update dieses Plugins eine Aktualisierung der Plugin-Datenbank-Tabellen erfordert, so muss sichergestellt werden, dass die Tabellen aller Blogs, die das Plugin einsetzen, aktualisiert werden!][/lang_de]

7. Mai 2008
von Tobias
1 Kommentar

[lang_en]Word of the day I[/lang_en][lang_de]Wort des Tages I[/lang_de]

[lang_en]Every now and then you stumble across notably charming or annoying words and expressions. I’ll be presenting some of them here once in a while, starting with a term Adrian invented not so long ago:

(to) outgoogle: to find a result at Google faster than someone else

„Damn, you outgoogled me again with that milk prices!“

[/lang_en]
[lang_de]Hin und wieder stolpert man im Alltag ja über besonders charmante oder widerwärtige Wörter und Redewendungen. In loser Reihenfolge will ich ein paar davon hier vorstellen. Den Anfang macht der folgende vor einiger Zeit von Adrian erfundene Begriff:

ausgooglen: schneller als jemand anderes das gewünschte Resultat bei Google finden

„Verdammt, bei den Milchpreisen hast du mich ausgegooglet!“

[/lang_de]

6. Mai 2008
von Tobias
44 Kommentare

[lang_en]Multilingual blogging using WordPress[/lang_en][lang_de]Mehrsprachiges Bloggen mit WordPress[/lang_de]

[lang_en]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.[/lang_en]

[lang_de]Wie bereits erwähnt, habe ich ja schon länger geplant, zumindest zweisprachig auf Englisch und Deutsch zu bloggen. Den Aufwand mit Schwedisch auch noch eine zweite Übersetzung anzubieten, tue ich mir angesichts der geringen Nutzerzahlen jedoch nicht an, obwohl es sicherlich eine gute Übung wäre. Theoretisch möglich sollte es aber sein und damit war die Anforderung an das neue Blog-System nicht nur „zweisprachig“, sondern „mehrsprachig“. Fündig wurde ich beim WordPress-Plugin Language Switcher, das es durch die Verwendung bestimmter Tags erlaubt, mehrsprachige Artikel, Kategorien, Blogroll-Links oder Kommentare (!) zu verfassen.

Die Installation an sich ist auch recht simpel, wenn man die Hinweise der Installation-Anweisungen beachtet. Schwieriger war es da schon, auch das verwendete WordPress-Theme Dust 3.17 zu internationalisieren. Dabei wird für jede verwendete Sprache eine eigene Sprachdatei angelegt, deren Text im PHP-Code des Themes durch Platzhalter eingefügt wird. Aber auch dafür hält die Seite des Language Switcher-Plugins alle notwendigen Tipps bereit, sodass ich anschließend auch ohne größere Probleme das eingesetzte Quotes Collection-Plugin internationalisieren konnte. Den geänderten Code werde ich die Tage auch dem Autor Srini, mit dem ich in der letzten Woche bereits Kontakt aufgenommen habe, zur Verfügung stellen.[/lang_de]

5. Mai 2008
von Tobias
1 Kommentar

[lang_en]Let’s start![/lang_en][lang_de]Los geht’s![/lang_de]

[lang_en]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![/lang_en]

[lang_de]Herzlich Willkommen in meinem neuen Blog!

Nachdem ich mich ja zuletzt im Oktober vergangenen Jahres in dieser Form gemeldet habe, finde ich, ist es an der Zeit, dass ich mal wieder von mir hören lasse. Die entstandene längere Pause nutze ich dann auch gleich mal für einen Neuanfang. Passt auch zu den restlichen Umständen meines Lebens, dass sich im Moment doch ziemlich verändert, was nicht zuletzt daran liegt, dass ich in der Zwischenzeit damit beschäftigt war, meine Diplomarbeit zu schreiben und einzureichen. Und so bin ich nun seit dem 29. April offiziell nicht länger Student, sondern entlassen in die große, weite Arbeitswelt.

Mit diesem neuen Blog setze ich daher zugleich auch ein lang geplantes Projekt in die Realität um. Während das bisherige Blog-System selbst entwickelt war, verwende ich nun WordPress als Weblog Publishing System. Das liegt hauptsächlich daran, dass der Entwicklungs- und Wartungsaufwand für ein solches System doch immens ist, möchte man an allen Fronten mitkämpfen. Dem alten Blog fehlte jegliche Form der Suchmaschinenoptimierung (SEO) und um die schon lange geplante multilinguale Unterstützung zu implementieren, hätte ich den Großteil des Codes sowieso neuschreiben müssen. Da auch die bisherigen Experimente mit Ko-Autoren gescheitert sind und ich somit alleiniger Betreiber des Blogs war, fiel mir der Entschluss auch nicht allzu schwer. Also habe ich mir nun nach der Abgabe meine Diplomarbeit einen Ruck gegeben und unter der im letzten Jahr georderten Familien-Domain eine Fuhre Blogs installiert.

Und nun: Viel Spaß damit![/lang_de]