Code Less - Configure More

Thank you for your contribution: 

Ready for ModdingBefore I go into details I want to mention a few things about participation in open source software projects. When you start using the outcome of an open source project you are a part of the community. You can get something from the project and you can contribute to the project too.

PUT and GET (Give and Take)

As a member of the community you have to think about two things (let's compare it with the Hypertext Transfer Protocol methods GET and PUT)

  • What do you want to GET out of it (money?, fame?, friends?, free beer?, [... other ...])
  • What do you want to PUT into it ( code?, ideas?, logistics?, money? [... whatever ...]

What's your Job?

Open source project are mostly software projects and it's good to know your own job description. Are you a site builder, a developer, a designer, an architect, a "rockstar" or something totally different?

Developers

Years ago most of the community members were developers. They are developing code more or less like this!

PHP Code

PHP define(DRUPAL_ROOT, getcwd());
require_once DRUPAL_ROOT . /includes/ bootstrap.inc;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();

Drupal 7, index.php

JAVASCRIPT Code

$(input + source, context).once(date-time).keyup(function () {
var input = $(this);
var url = settings.lookup + (settings.lookup.match(/?q=/) ? &format= : ?format=) + encodeURIComponent(input.val()); $.getJSON(url, function (data) { $(suffix).empty().append( + settings.text + : <em> + data + </em>); }); });

Drupal 7, system.js

CSS Code

ul.menu li {
 margin: 0 0 0 0.5em; /* LTR */
}
ul li.expanded {
 list-style-image: url(../../misc/menu- expanded.png);
 list-style-type: circle;
}

Drupal 7, system.css

INFORMATION

; Information added by drupal.org packaging script on 2011-05-25
version = "7.2"
project = "drupal"
datestamp = "1306357016"

Drupal 7, system.info

"Code" is basically stored in text files with all kinds of information.

And the others?

If developer do all this stuff, what are site builders, designers, architects and rockstars doing? Are they necessary in an open source projects?

Let's jump to another world - Cars

Local Motors is an open source automobile company. They co-create vehicles with their community of auto designers, engineers, enthusiasts and customers. Local Motors is in production with their first vehicle called the Rally Fighter, an off-road race vehicle designed to also be street legal which customers buy as part of a build experience with Local Motors engineers in a Local Motors Micro-factory (Figure 1).

www.local-motors.com
cocoate.com/node/8869Future Car

Figure 1: Future car from Local Motors

The Rally Fighter, designed by community member Sangho Kim is the first car to be openly developed and built with the collaboration of the local motors community. Sangho penned the Rally Fighter design in 2008, and posted it to the Local Motors community for review and critique. Community feedback was immediately positive, and many demanded the car to be built. You can download the chassis file from http://www.local-motors.com/open.php (Figure 2), create a microfactory and build it (Figure 3) and finally mod the produced car (Figure 4).

www.local-motors.com
cocoate.com/node/8869Download the Chassis File :)

Figure 2: Chassis file download

www.local-motors.com
cocoate.com/node/8869Micro Factory

Figure 3: Micro Factory

www.local-motors.com
cocoate.com/node/8869Ready for Modding

Figure 4: Ready for Modding

How does it work?

The process in general is quite simple

  1. Getting started
  2. Create it
  3. Develop it
  4. Build it
  5. Mod it

Text from the YouTube video description:
As an Automotive 3.0 company, Local Motors works very differently than any other car company in the world. This video will give you insight into how Local Motors harnesses the power of the community, while also empowering the community to create, develop, build, and mod new, original cars.

Creating Websites

Even if it sound simple. Most of the outcomes of Drupal, Joomla!, WordPress and TYPO3 projects are websites and it is so much easier compared to the car example.

If we look at the five steps again and think of our behaviour in software projects like Drupal 7, it looks a bit like this:

  1. Getting started done
  2. Create it <-  done (that's the design)
  3. Develop it <- done
  4. Built it <- "Drupal Shop" or web agency
  5. Mod it <- "one man army" or freelancer

So most of the work is already done and now it's time to configure it in the right way.
If you look at step 4 and 5 and think of the existing 10,000 Drupal pieces to play with (http://drupal.org/project/modules), you see it's a big playground.

Lego for the kids. And, the adults.Lego

Figure 5: http://www.flickr.com/photos/philliecasa... (CC BY 2.0)

And as in Lego you can build many different things or in case of Drupal, different websites!

A house and a car

Lego art work, created by a under occupied psychology student. (Not me)Lego house

Figure 5: http://www.flickr.com/photos/m-nicolson/2414298534/ (CC BY 2.0)

Something useful

Lego technic set 8275 from 2007Lego Motorised Bulldozer (8275)

Figure 6: http://www.flickr.com/photos/popcorncx/3514881626/ (CC BY 2.0)

... more elegant

Yes it's a lego car, made with Lego's, yes the kids building blocks.  In the Lions Head area of Vail.Lego Car

Figure 7: http://www.flickr.com/photos/pswansen/207418232/ (CC BY 2.0)

... really big

Ok, it's a fake - no Lego, no Drupal - but really big :)
It's all about manufacturing http://en.wikipedia.org/wiki/Manufacturing

still under constructionStatic Section 41

Figure 8: http://www.flickr.com/photos/markjhandel... (CC BY 2.0)

Keep it simple

Most of the customers will mention in the first meeting that their business is totally different from the others and much more complicated. Often this is the step where the website starts to become more and more expensive (often through custom development).

Be aware that clients often don’t get the idea of an open source project and your wonderful customization and other things, even though they spend €500,000+  on their website. For them it is important to solve 'their' problem, whatever it may be, and whether you solve it with Drupal, Twix, Volkswagen or other brands is irrelevant.

A short example

Usually when I am working in the office Skype is switched on.

Question via Skype:

Where can I translate this text?” ... BLAH ...

It was about blocks on the frontpage of a client's website - at that point, not our client.

A few minutes later I received the following messages (hope arises)

I found a possibility in the block administration.

I created 4 new blocks :)

cocoate.com/node/8869Language Selection

Figure 9: language settings in blocks

... awesome system ...

10 minutes later

The blocks are not appearing on the site :(

... Longer chat via skype about what to do  (30 minutes)

... Exchange of FTP credentials

... my thoughts:

ohlala - this is getting bigger ...

After some research I found this in template.php:

if ($vars[view]->name == _NAME_ &&
 $vars[display_id] == block_3) {
 if (drupal_is_front_page()){ 
$vars[more] = l(... TEXT TO 
TRANSLATE ..., _NAME_, array
 (attributes => array(class =>
 _CSS_FOR_BLOCK_))); } }

First problem: No translation is possible via the Drupal UI because the t() function is missing.

Second problem: No translation is possible via different blocks! The existing code need block_3

From my point of view the real problem for all of us is the normal reaction of the client.

Client:

"Drupal is so complicated!”

Me:

“...”

and who will to pay me for this info? - No one ...

This happens often to me but problems create markets and now we have a new client. :)

My message to web agencies and one-man armies:

  • DEAR WEB AGENCY
    AFTER BUILDING IT
    (AND HOPEFULLY BEING PAYED)
    CONTRIBUTE AS MUCH
    AS POSSIBLE TO THE PROJECT
    YOU’LL HAVE ADVANTAGES
    FOR THE NEXT CONTRACT
  • DEAR ONE MAN ARMY
    AFTER MODDING IT
    (AND GET WHAT YOU WANT)
    SPREAD THE WORD
    ABOUT YOUR WORK
    YOU’LL HAVE ADVANTAGES
    FOR YOUR NEXT GOAL

Happy clients like to pay for your idea, creativity and your work.

Most excellent wife J. was 30 on this day. We celebrated by wearing Power Ranger suits on Whitehaven Beach, QLD. As you do. 
I love my wife.
(taken 14.06.11, uploaded 21.06.11)Happy Bluebirthday J.! (165/365)

Figure 10: http://www.flickr.com/photos/dpgreen/5854718132/ (CC BY 2.0)

Remember the 10,000 Drupal modules to play with and just have a look at them before you start coding.

Just two things from my experience in smaller and bigger Drupal projects.

  • 80+ % can be achieved via configuration
  • A big part of the costs of a website are a result of unnecessary coding

Code less - Configure more

After this long introduction we are coming to the point. The problem with configuration is often that the user interfaces are not user-friendly because of the complexity. One example is the views module. It is always possible to discover new settings and checkboxes you've never seen before :)

Configurations examples from the real world

Johan Falk from NodeOne did an amazing job in creating screencasts on advanced Drupal configuration. A bit feedback?

i think @Itangalo is going for the worldrecord in "most free drupal screencast in shortest time, that kicks ass"
 
Great screencast. I stared at the redirect destination field forever and didn’t realize I could use the variables in that field until this demo.
 
I want to thank you for this wonderful series, I have learned a lot with your screen cast and now can see the real power behind Drupal and modules like Panels.
 
This series is already awesome— I was unaware that there were other modules, besides panels, that make use of page manager.
 
Great work Johan, keep it up! I’ve learned a lot of Drupal with NodeOne’s screencasts.
 
Just wanted to say thanks for such an entertaining and helpful series here, I really learnt a lot!
 
1000* thanks @itangalo of @nodeone_se for your excellent screencast demonstrating the power of #drupal #pagemanager.

@itangalo
used in: cocoate.com/node/8869Johan Falk

Figure 11: Johan Falk

You'll find all examples on http://nodeone.se/exercises and I want to mention just a few examples to give an impression what's possible 'only' by configuring.

Views

As site member I want a tab on my user page showing all content I have posted to the site. The page should also show how many comments each piece of content has, and if there are any comments I have not yet read. This is important because it helps me keep track of discussions I participate in.

This user story is complete when: 
  • There is a tab on each user page.
  • The tab leads to a page showing content posted by that user (and only that user).
  • The page shows content title, number of comments and if there are any unread comments; in a table.

nodeone.se/node/735
used in: cocoate.com/node/8869Adding a user tab

Figure 12: Tab with user's content

Read more instruction on on http://nodeone.se/node/735

Flags

This screencast is a part of the Learn Flag with NodeOne screencast series, introducing the Flag module and showing some different use cases. This episodes introduces the Flag module and some of its core concepts.

This screencast covers the following topics:

  • Installing the Flag module
  • What flags are and how they are used on your website
  • Some modules that Flag integrates with
  • The default bookmarks flag, and its view

Flag + Rules + Content Access

This screencast shows how to use Content Access and Rules to set and revoke access to nodes. It covers:

  • Using Rules to grant access to individual nodes
  • Using Rules to revoke access to individual nodes
  • Using Rules to reset the access for an individual node
  • Implementing the features above to control node access with a flag

I learned even more about these kind of modules in Tino's chapter (Content Make-Up | Display Suite for Drupal 7)

Slides