Hyper-dynamic Drupal sites with Panels and Views
The motivation for writing this article came from my feeble attempts at trying to discuss a module I'm actively working on (to be covered in a future article) with several very intelligent Drupal developers. Due to the inherently abstract nature of the issues, and for lack of a common language, the end result was that in every case each person just ended up scratching their heads at me without really comprehending what I was really trying to get at.
Technically speaking, Drupal offers a dynamic framework right out of the box, right, so what is meant by "hyper-dynamic"?
Hyper-dynamic, for lack of a better description, refers to sites/sections-of-a-site for which pages do not exist as individual nodes, AND which (for example) are more complex than a single static view/panel. A panel/view which takes arguments, particularly multiple arguments, is an example of hyper-dynamic content delivery.
Getting down to business...
How is this idea of hyper-dynamic content useful and/or or what are the use cases?
As a 'simple' example, let's say we have a multi-regional travel site which caters to people looking for info/deals on casinos. For each region, we'd like to have a separate homepage, AND separate landing pages for each casino within the region. Finally, let's throw in a "Deals" subpage for every region/casino.
So the site hierarchy would look like this:
Name that tune
The challenge is to figure out the fewest parts we can make this architecture, while still maintaining flexibility/maintainability/upgradability.
In this case, we can accomplish our proposed site hierarchy, for an unlimited number of regions/casinos, with as little as 3 views, 3 panels, 2 content-types, and a handful or arguments:
1. "Node listing" - provides node-listing for each region/casino determined by arguments. This view is placed in the "Landing panel" (see below).
2. "Deals listing" - provides deals node-listing for each region/casino. This view is placed within the "Deals panel" (see below).
3. "Homepage listing" - provides node-listing for homepage. This view is place within the "Homepage panel" (see below).
1. Landing panel - Provides complete landing page for each region/casino based on arguments
2. Deals panel - Provides complete "Deals" subpage for each region/casino based on arguments
3. Homepage panel - Provides homepage. Could theoretically even get away with just using the landing panel for this, but by using a separate one for the homepage we get a little more
flexibility and sanity.
1. "Article" - a general container that can be promoted to appear on any given region/casino landing page or the site homepage.
2. "Deal" - includes specialized fields, and which will appear on the "Deals" subpages for each region/casino and which can also be promoted to appear on any given region/casino landing page.
While having the possibility of an infinite number of regions/casinos and a gazillion pages from just 3 views, and 3 panels is pretty awesome, there are some considerations that come along with doing this:
With all of those arguments we sure are going to have some ugly urls aren't we? Well, not if we set some path aliases.
How are we going to get our wonderful breadcrumb trail for each of this hyper-dynamic pages? Not the normal way that's for sure. If we're using our path aliases intelligently, here's something that can work though.
A "Deals" link
We will need a "Deals" link to appear on each region/casino landing page, and on each of the individual "deal" nodes for a given region/casino, and on the "Deals" page itself within each region/casino. How in the world to get such a thing without making a custom menu for each of our regions/casinos and setting the visibility on it? This is the very issue that I'm addressing with a module I've made and am working on a UI for, atm.
I'm planning on a follow up article on this subject, so please leave productive thoughts, ideas, questions that might be worth taking into account below. :-)