One tip:
You will likely have several views that require similar formatting. Creating templates for each of these types and copying them creates a code branching nightmare - if you are asked to change the whole appearance of the site (meaning changing the display of each of these types formatted in this way), you must go back and edit each of them separately.
Instead of using the views interface to select new templates for views, I sometimes just insert some code branches into a single views file. For example. for one site in views-view-fields.tpl.php I have:
if($view->name == 'articleList' || $view->name == 'frontList' || $view->name == 'archiveList') { } else { }
Then it changes the fields the way I want only for this family Views = articleList, frontList and archiveList, and for other views using this template, the code that is usually found in this template is executed. If a client asks: βHey, could you make these pages showing archives and this list on the first page to look bigger (...)β, itβs just a matter of opening and editing this one file instead of three different files. Maintenance becomes much faster and friendlier.
James Mar 24 2018-11-11T00: 00Z
source share