Display suite slides from DrupalCamp Gent

First day of DrupalCamp Gent is over and it was really nice to see many new people attending this time, the Belgium community is really growing baby! And the regular bunch was present too, always nice to see old faces back for a nice chat. I also gave a presentation about the Display suite module and the first reactions were positive, got some good feedback and a few interesting feature requests, so I think we're on a good track here. If anyone's interested in my slides, they are attached at the end of this post.

A few people also asked me if it was safe to start using the module(s) in production. The simple answer is yes, the API is frozen and stable. Node displays and contributions are also stable to use on your website and we're busy working to finish the user and comments part. Our goal is to roll out a first official release on new years eve, a nice present to start a new decennium.

Mars Volta

If there's one song I would love to have heard this sunday in the Vooruit, it really was Drunkship of Lanterns. Can't complain though, the band played almost played everything from http://en.wikipedia.org/wiki/De-Loused_in_the_Comatorium, their debut album. No Flea or John Frusciante either, can't have it all right :) Thank god for YouTube of course!

Topics 

music

Node displays and Display suite now agile driven


For a few months now, every project at work is handled in an agile way with the SCRUM principle and our development team gets a free day every two weeks to work on their own projects using the same technique. This gives us a good overview where we are and what we want to do in the future. Most projects during our free time is done on modules we're using in projects which we're contributing back to the Drupal community. Most of my time went into Node displays and Display suite and after a few iterations we're pleased to announce some good news!

The original version of ND and ND contrib is now available in the 6--1 branch and will be maintained only for bug fixes. We've not yet released an official version, but the API is finally frozen, so you can start testing without fearing to upgrade in the future. New features will go in the 6--2 branch which is dependant on DS. There is no real upgrade path between both branches, so make sure you make the right decision before starting on a project.

DS, short for Display suite, is an API which makes it possible to control the display of any data object (nodes, comments, users ..) in every context (full node, full user view, teaser, ...). The project page lists modules which are already available, some of which are pretty stable (nd) while others still need some love (ud and cd).

As you can see in the picture, we still have a lot of tasks we want to implement, but it's really keeping us focused and motivated :)

Launch of the new Boek.be site


Today we relaunched the new Boek.be website. With a tight deadline to bring this project online in only 3 weeks because tomorrow it's the start of 'Boekenbeurs', Belgian's famous annual book fair, we're more than happy of what we've achieved in that small period. Users can register and create their own collection of favorite books, add comments, rate and share them on facebook and/or twitter. There's more to come in the next few weeks, but it's a nice start.

I briefly want to highlight 2 main Drupal modules we use extensively in the site. The first one is Apache Solr. With over 250k of nodes (and growing), this was an obvious decision. We all know Drupal core search isn't the best in performance and decent searches. We used all hooks available to manipulate searches and as good Drupal citizens contributed some patches back to the community. There is still one left which we'd like to go in, so please review!

I'm biased for the second one, since I'm one of the maintainers, but the site (and also Stubru.be) uses modules grouped in the Display suite concept. Our themers love it, no more fiddling with node, views, user, whatever templates, just CSS. Our account managers love it, they use the interface to manipulate each context if the client asks for a little change without asking us themers or developers. And we developers love it, we have hooks :)

We're working on a document which we'll post somewhere next week on d.o with a more detailed description on how the site was built, so stay tuned!

Random results with Apache Solr and Drupal

The schema.xml that comes with the Drupal Apache Solr module doesn't define the random_* field compared to the default xml included in the apachesolr package. We needed that functionality for a project where we wanted to display 3 blocks which showed random results based on a couple of fields available in the node, in our case the author, title and a cck field. With 300k nodes, a random result was giving a nicer experience instead of seeing the same results coming back over and over. Adding random order is pretty easy in a few simple steps: http://lucene.apache.org/solr/api/org/apache/solr/schema/RandomSortField...

Implementing the tags from that manual did not have a lot of success, however, after some fiddling, following changes in the xml seem to do the trick. Feel free to add comments and suggestions.

   <!-- goes in types -->
    <fieldType name="rand" class="solr.RandomSortField" indexed="true" />

  <!-- goes in fields -->
   <dynamicField name="random*" type="rand" indexed="true" stored="true"/>

After indexing your nodes, try to run following query on your solr admin page:

http://localhost:port/solr/select?q=whatever&morekeyshere&sort=random_127789 desc

Our blocks are defined via hook_block which uses the apachesolr_search_execute() function to launch our query to the solr engine. With the hook_apachesolr_modify_query you can add a sort parameter and you'll get your random results.

<?php
function hook_apachesolr_modify_query(&$query, &$params, $caller) {
  if (
$caller == 'whatever') {
   
$seed = rand(1, 200);
   
$params['qt'] = 'standard';
   
$params['sort'] = 'random_'. $seed .' asc';
  }
}
?>

Pages

Subscribe to realize.be RSS