building-pages-with-drupal-or-what-are-nodes-blocks-views-panels.jpg

Building pages with Drupal (or what are nodes, blocks, views and panels?)

As with most tasks you’ll face when creating or managing a website using the Drupal content management system (CMS) there are multiple ways to create and display content. In this article we’ll look at the four main content creation, curation and display methods that we use when building sites for clients.

Nodes

Nodes are items of content, based around a collection of content fields – so your gallery images that consist of a title, image and caption are one type of node and your products containing information such as price, sizes, colours along with descriptions, images and product names are another type of node.

Think of nodes as containers for your content and they start to make sense. Visibility of nodes can be limited by the type of user viewing them (so some nodes could only be visible to registered site visitors, some to administrators and others to anyone).

Blocks

Blocks are boxes that tend to occupy regions within pages – so a footer, sidebar, or header or above or below the page content, content which is normally based on a simple view of a node (a basic page for example) or is made up of multiple items of content such as a gallery or blog (which we construct with views).

They can be as simple as a copyright statement at the bottom of your website or as complicated as a “top blog posts” or “recent photos” sidebar within your website’s blog. Blocks usually contain text or programmatically created content (such as our call performance block on the contact us page of our website which links into our phone system).

Blocks can also appear within panel based layouts (using Panels) which we’ll explain later in this article.

Views

In its default form, Drupal will let you show and hide individual fields and change an image size along with allowing you to make a basic listing of content. The Drupal Views module allows you to curate and display your content in almost any way you can think of enabling you to mix and match data into all kinds of custom listings.

Views aren’t content, they are used to display content but you may find that your site only displays content through a number of different views (such as a calendar or table based view).

We regularly use Views to style blog and new pages, create gallery sections and to enable sites to display calendars of events but that just scratches the surface of what Views can do.

Panels

The Panels module enables a website administrator to create customised page layouts using a drag and drop content manager that lets you visually design a layout and place content within that layout. Panels can be made up of blocks, nodes and views (which is why we’re discussing them last!)

We use Panels to achieve things as simple as a contact us page – with a contact form on one side and contact information on the other – which allows the website administrator to edit the contact details quickly and easily. For more complex sites we may use Panels to create a page that shows related content alongside a blog post. Panels essentially give you masses of control over how the content on your site is displayed to your visitors without you needing any programming knowledge.