WordPress 2.7 beta soon

Quick note: Version 2.7 of WordPress is coming soon. Ryan has announced the feature freeze. This blog has been running the trunk-version that has been leading to 2.7 for quite a while now. Part of it is to be on top of things, but also to be able to test wp-stattraq with 2.7. And: it still works!

Oh! And the interface doesn’t look like this yet:

but like this:

wordpress27

Using nanocms to create a simple site with news

For a client of mine i've been looking for a way to host his very simple and small site. The site (which can be found here in its old outfit) consists of some rather static pages, two formulas, which have to be sent by email and a news section that is split into two categories (events and tours). Both news categories land in a collective archive after a specific date.

Until now, the site has been using a selfmade content management system, which reads custom files in some directories. Every time i wanted to change the content of an event article, add a new one or move it to the archive i had to manually change the files. You have to have in mind, that the customer asked for a rather minimalistic server hosting solution and i didn't see it as necessary for him to have a database in the hosting package. The problem is that most content management systems are in need of a database of some sort (mostly mysql). Yes i am aware of plugins for cmss that can do the job. But mostly the systems are too complicated to setup for this simple site..

In come nanocms. Nanocms is being developed by Kalyan Chakravarthy who runs his own blog over at kalyanchakravarthy.net (last update about nanocms). From the description of the project:

Nano CMS is the tinyest CMS you can find around...:)
The user interface and the functionality are very very simple and easy to use.
NanoCMS is filebased, so no database blah,. Easy to install

Through this CMS you can create pages without actually touching any code.
You can manage website pages very easily and the links in the sidebar are generated automatically...

Indeed nanocms is really small and well written for that. The main functionality consists of creating pages, which are then stored in distinct files in a specific folder. The only way to sort the pages on the site is to include them in different categories (each page can be a member in different categories) and then using those categories for displaying menus. There is no way of specifying a hierarchy for the pages. The sort order of the pages inside each category though can be changed independently.

Now, this functionality doesn't provide exactly what i needed, since i wanted some "pages" (/posts) to be shown on the same webpage - like a blog. Also, i needed submenus to allow the navigation the client was asking for.

So, this is what i did..

To extend the functionality of nanocms i created "customfunctions.php" with the following two functions:

PHP:
  1. <?php
  2.  
  3. function show_contents($cat){
  4.     global $cap;
  5.     $itemlist = get_links_array($cat);
  6.     foreach( $itemlist as $slug=>$title ){
  7.         show_content($slug);
  8.         echo '<hr />';
  9.     }
  10. }
  11.  
  12. function show_content($slug){
  13.     $contentFile = pageDataDir( $slug );
  14.     if( file_exists( $contentFile ) ) {
  15.         runTweak( 'slug_load_before' );
  16.         require_once( $contentFile );
  17.         runTweak( 'slug_load_after' );
  18.     }
  19.     else {
  20.         header("HTTP/1.0 404 Not Found");
  21.         echo "404 : File Requested was Not Found";
  22.     }
  23. }
  24. ?>

The function "show_contents" is a near-copy of the native function "show_links" which shows all the links to the pages inside a category. "show_content" is a near-copy of "show_content_slug" with the only difference, that "show_content_slug" doesn't accept any argument and gets the page slug from the global variable $cap.

With those two functions i'm now able to show a page inside another page (which i use to display the "Kontakt"-page under the welcome message) and i'm able to show the content of a category.

So, the content of "Aktuelles" becomes the following small script:

PHP:
  1. <h2>Aktuelles</h2>
  2.  
  3. <?php show_contents('aktuelles'); ?>

And here is a link to the site, as i proposed it to the client: www.campuscultur.de/nano/

Gengo and woopra plugin

I just found out, that there is a problem with running the woopra wordpress plugin together with gengo. Gengo is the multilingual plugin running in the background of this blog. Woopra is an external statistics program that has a nice wordpress plugin (which by the way is looking for some translation work itself).

Anyway, when i activate the woopra-plugin it says

Fatal error: Call to a member function wp_rewrite_rules() on a non-object in /var/www/oan/htdocs/wp-includes/classes.php on line 145

First, i thought it's a compatibility thing with wordpress 2.7 (right now: "2.7-almost-beta), but it seems to work when i deactivate gengo. I found this quote on the gengo-blog which i am quoting since the site has some database problems:

If that happens, the plugin you just activated has been written incorrectly. It is trying to set its language too early, before Gengo has loaded. The solution is an easy one - the call to load_plugin_textdomain() in the plugin must be moved so that it is run on the ‘init’ hook. Do your plugin author a favour - drop them an email letting them know the problem and see if they’ll fix it - many authors don’t know that this is even a problem! Make sure you’re polite when you do, though. From personal experience, I can tell you it’s not pleasant to receive an angry email from a stranger, demanding that you fix something that you’ve released for free.

Hope, someone from over at woopra can change the code accordingly. Meanwhile i'm relying on the stattraq-plugin..