Templates concept for bTween

Brief

The task is to create various templates for the nodes depends on their types and conditions.

In this project, nodes can be roughly categorised into 2 groups:
(1). Admin-only.
(2). User-generated. Nodes in this group can be subdivided into 3 groups:
2a. User node. Biography is used for this purpose;
2b. Text-based nodes including discussion and feed;
2c. Multimedia-based nodes including quickfire, interactive gallery, exploding narrative, enterprising ideas and branding talent.

concept drawing

node-teaser.tpl.php and node-full.tpl.php

In the standard node.tpl.php, a if condition checks whether to load the teaser template or the full node template:

if($teaser): 
  include('node-teaser.tpl.php');
else:
  include('node-full.tpl.php');
endif;

It doesn't have any difference with a normal node.tpl. The reason it’s written in this way is for the sake of maintenance as there are many different teaser templates for different node types. The teaser template serves for the most of node types.

The teaser templates

An ordinary node template is used for admin-only nodes. One exception here is the session node.
session teaser view

For user-generated nodes, a landscape type of template is used for text-based nodes while a portrait type is used for multimedia-based nodes.

teaser views

The node teasers are mainly used in View pages.

Normally I use ‘list view’ instead of ‘teaser list’ to create the View pages. However, there are 40-ish Views used in this project. Setting up such a big amount of Views using ‘list view’ seems to be a really time-consuming way. Besides, the client requests to show the avatar picture of the author where a node has no image attached.

Under these conditions, the ‘tease list’ looks like a better and quicker solution.

The only two exceptions are interactive gallery and quickfire . The primary image field or video field is mandatory for these two multimedia-based node types. In this case ‘list view’ is used to build View pages.

The full node templates

Apart from admin-only nodes (page, session and webform), all node content types have a similar template structure.
A badge-alike section under the node title displays a few information about the author, followed by statistic data of the node.
full node views

Plan

A plan ahead is always prerequisite - which I didn't do well in this project. Consequently a great deal of time was wasted on changing the template structures over and over again. But in the end a good concept of the template model has been formed - one that can be easily maintained and have good flexibility.