Using DPRES

The default Waiter supplied with DPRES is a PHP application that uses the Twig templating library to merge HTML templates with JSON data supplied by the Cook. It includes a set of demo templates designed to work with a demo publication (also supplied). The Waiter also includes patternlab.io, a PHP application that supports atomic design. Atomic design is a design methodology that provides a framework for breaking web site designs down into re-usable components. The supplied demo templates are structured using atomic design, and can be viewed from the Patternlab.io interface.

You can create a DPRES presentation layer for your own publication based on the supplied demo as follows:

  1. Install the DPRES demo as described in Getting Started.

  2. Run the demo's update-schema.sh script to replace the demo publication schema with your publication's schema. See Updating a GraphQL Schema for further information.

  3. Modify the supplied GraphQL queries to work with the new GraphQL schema.

  4. Modify the Twig supplied templates to work with the JSON structures output by your GraphQL queries (or replace them with a completely new set of templates).

  5. Continue modifying the supplied Twig templates until they produce the output you require.

You don't necessarily need to perform the tasks in this order. In many organisations, steps 4 and 5 will be carried out by different people from steps 2 and 3, so it might then make sense to perform them in parallel. You could also work backwards by creating a design first, then defining the JSON structures needed to support that design, and then creating the GraphQL queries needed to produce those structures. In reality, wherever you start, the process will more than likely be an iterative one in which parallel adjustments need to be made in GraphQL queries, Twig templates and possibly also the publication definition (content-type and layout-group resources).

However, it's probably easiest to understand how DPRES works by following the data flow from the publication structure to the rendered page.