This site is archived.
Skip to Content

Views 2 for coders 4 hours hands-on training

Your session in a few words: 
Views 2 for coders 4 hours hands-on training
September 1, 2009 - 13:00 - 17:00
David Weill
From zero to hero
Session Type: 
Level of expertise: 

And for those of you who are seasoned Drupal coders, we have prepared a hands on training session to get into the rhythm : Views 2 for Coders (4 hours hand-on workshop).

The training session will be held in English by the very excellent Frederic Marand from OSInet

Though not obligatory, those who wish to participate in the training session are encouraged to donate to French Drupal Association (the funds collected will serve to organize further community events).

To participate you should be familiar with drupal module development, PHP5 object model
and admin-level Views 2.


Learn to optimize Views integration in your modules:

  • choosing whether or not to use code-based Views vs Views UI
  • integrating Views in code instead of the DB (i.e. defining default views) (w. exercises)
  • defining Views data sources: tables, fields, relationships (w. exercises)
  • defining application-specific arguments, filters, sorts (w. exercises)
  • implementing new Views display types
  • just a small note about Views theming (not enough time in 4h)
  • altering other Views integrations (w. exercises)
  • documenting Views: API, doxygen, Advanced help
  • performance notes


The session will be a mix of slide-based presentation with application exercises to apply the theory.

Esmerel should be with us to introduce Merlinofchaos' upcoming Views book.

Attendees will need to have an already configured PC with Drupal 6, Views 6.2.6 and their favorite IDE operational in order to work on the exercises and access source code. A typical recommended configuration would be:

  • A clean Drupal 6.13 install on MAMP/WAMP/whatever
  • Views 2.6, Views UI
  • Devel
  • Advanced help
  • CVS client
  • A good browser (I like Opera a lot)
  • Net access

This session or Crell's ?

Crell and I have tried to keep our sessions as distinct as possible to avoid duplication. He will talk more about overall architecture, themeing/style and accesss plugins ; while this session will focus more on the practical aspects of beginning with code-based Views, and data manipulation.

English or French ?

To be decided by the attendees.

Co presenters: 

PHP5 object model Isn't views

PHP5 object model

Isn't views programmed on php4 object level?

Do you plan to present something about custom views caching plugins?

PHP5 recommended, not mandatory

Well, Views 2 still use the old PHP4 constructor (view::view()), but this is explicitly allowed by PHP5 as a fallback since view::__construct() is not defined. Which opens some interesting overriding possibilities, if you think of it. This being said, Views mostly relies on its specific views_object::construct () mechanism instead of the builtin PHP4 or PHP5 one, so it does not really matter on that count.

Beyond constructors, the 6.2.x code includes several references to "would be ... if PHP4 supported it", which don't need an explanation for those already familiar with PHP5. And some mechanisms (like autoloading) which had to be created in scripting due to PHP4 also map nicely to PHP5 which, again, will be more familiar to PHP5 devs.

So, in short: PHP5 is not a requirement to understand Views, but it certainly helps, which is why I recommend it.

Regarding the contents of the session, access and caching are the two "advanced" parts of the session, which will make it or not depending on the rhythm at which the session can progress. I'm trying to make it mostly for devs who never coded anything to the Views API, not to advanced Views devs, who will probably want to hear Crell's session, just like me.

Tech knowledge

As a dev who's never coded anything to the Views API, this session sounds really interesting, but just how familiar with PHP4/5 object syntax does one need to be to get the most out of this session? I see that the session is aimed at 'intermediate' level - does that mean vaguely familiar with adding/modifying/retrieving data from an object, or a Chx-like knowledge of the internal PHP workings?

And are there Views API docs which it would be useful to brush-up on before attending? Just so I don't feel too silly...

Rather the first option

It's rather for the first option than for the second. I don't think chx would learn anything here :-)

If you are familiar with the basics from this would be sufficient. As discussed above with dereine, there are no specific PHP5 constructs in Views 2.x (like abstract, interface, autoload, __* methods...), but it may help to understand what they are when reading the Views source code.

In the meantime, you could enable advanced_help.module on your site, and browse the "Views" section.

Thanks for those 'précisions'

Thanks for those 'précisions' ... time for a bit of OOP revision, I guess!

Spread of skills among attendees?

Depending on the spread of skills at the session, it might be nice if we could split into a couple of streams. Personally, I really want to understand themeing, display plugins, and as much of the views hook workflow as possible: but I appreciate that might be at a different level from other people there.

I realise that it might be hard work to run multiple streams. Either way, I'm really looking forward to this and crell's talk together.

Rather like Crell's session

I don't plan on doing much about plugins (just something about display plugins and a few words about style/row/field plugins), and nothing about themeing. It sounds like you'll need more from Crell's session than from this one, as he said he'd be talking about these topics.

Also, the schedule is already defined, with several exercises (and solutions !) planned, following some sort of logical progression for attendees, so I'm afraid multiple streams are not likely.

That's fair enough - sounds

That's fair enough - sounds like you're packed out down there anyway. Happy to keep away if you think Crell's talk's going to be more at the right level.

If you could put as much info about the training session as possible online then that'd be really great - even a few notes about what was covered, especially hooks - although I appreciate it's not suited to videocasting all four hours!

Registration needed?

Is a Registration needed or can i simply come?

This is during DrupalCamp

This is during DrupalCamp Paris 4, so you need to register for the camp itself at

Beyond this, it will be first come, first serve: this being a workshop and not an ex-cathedra session, the number of available seats will necessarily be limited.

Please put up your slides

They're better than nothing. They give some ideas in which direction to explore as well as some suggestions for promising exercises.

Course material downloads

The code for the solution of the exercises of the course is downloadable from