Spirit Library - complex panels 2/views based drupal site
Spirit Library is library of spiritual messages and information. It contains thousands of articles/messages from spiritual speakers and authors which are filterable and sortable in different ways. The site extensively uses the excellent Panels 2 modules alongside Views.
This is the third incarnation of the site, and the one that finally gets very close to where we wanted to be with it. The first version was launched 18 months ago as a Plone site, as that was the CMS i had most experience with, but after a while it became too restrictive and we started looking in Drupals direction. For the second version we migrated the site from Plone, and the change coincided with a large jump in traffic and at the same time gave the vps it was hosted on more room as it used less server resources (especially memory).
Content Types
The Content Construction Kit module is used throughout the site to allow us to add the different types of content we need - messages, people, spiritual groups etc.
The main content type on the site is for the messages, each message has an Author and some messages also belong to a spiritual group. We use Node Reference fields to track these relationships, and to help with the theming the site we built a series of custom functions that allow easy access to the parent or child nodes.
The url's of each message contains either the author or the group so we combine the pathauto module along with custom tokens to determine what the path should be at the time of saving (using the token_values hook). If it has a group set we use that path, otherwise we use the author name. e.g. /group-title/message-title or /author-name/message-title.
We use a few other fields throughout the site including Embedded Field for youtube videos, Date fields (with the JSTools calendar) and we also use some ActiveSelect tweaks to make content entry easier.
Migration from Plone
After a lot of research and thought, we used the Import HTML module to import the site from Plone.
The first step was to make the structure and content types we needed in Drupal to mirror those we already had in Plone. Then from the Plone site we created some simplified templates that outputed a list of links to only the pages we wanted to export, mainly the messages themselves and author profiles.
To make importing easier we then wrapped the different fields on the page with div/span tags, setting the id to the drupal fieldname so import_html could understand:
<div>A message from <span id="field-person">Author Name</span></div>
The reason we chose this approach rather than creating full xml templates was just simplicity and time, and it also meant that it was easier to keep the same url structure inplace.
Once the templates were created we ran a recursive wget command on the same server to save every page we wanted to import into a folder that maintained the correct structure. We then ran Import HTML's import command and pointed it to the relevant base folder and chose which content type to use to import. To prevent memory errors we imported pages section by section, usually a 100-200 at a time.
Panels
The main layout of the site is created using the flexible layout of panels 2, which is a really great module - thanks merlinofchaos!.
We use panels in a few different ways throughout the site:
- Simple panel pages such as the homepage, these contain a selection of blocks, views and mini panels.
- Views based panel pages, these usually contain a view on the left such as the messages, archives or videos pages. They pass arguments into the views and also have a filter on the right which allows targeting the information shown
- Node panel pages, these as used for the individual message and the author profiles, allow display of the content of the node as well as contextual information about the message's author or group. These use the node id context along with different layouts for each content type
- Mini Panels are also used to create the tabbed blocks used through out the site. Using the tabs panel style makes this very simple indeed
Views
Throughout the site we use some custom modules for manipulating the near-essential views module and adding filters dynamically. The argument handling in views is very good but it didn't give us enough control over the url's.
So we built a custom module that parses the argument array (fired from the argument handler php code) and determines exactly what kind of filters and sort methods are required. Then it programmatically adds them to the view by manipulating the views object. (more info on dynamic filters)
This gives us much better control over the url, for instance in the message section we have the following structure:
Default:
/messages
Sorted
/messages/popular
Filtered by Author
/messages/author-name
Filtered and sorted:
/messages/author-name/popular
A futher example of this is the archive section where we allow you to drill down by date and view information either yearly, monthly or daily. You can also view the information filtered by author or group and it retains the period of time you were looking at before you started filtering. The custom modules mean that the entire archive system only uses one view for all the information it shows, and it also has some currently hidden features like the ability to switch views layout based on the url:
/messages/archive/2007/1 (normal table view)/messages/archive/list/2007/1 (teaser view)/messages/archive/calendar/2007/1 (uses calendar module)
The filter block on the right allows you to filter the current view by author, and maintains the same sorting and view layout when you add it and remove it.
Search
The search system, which uses Views Fastsearch, needs to go through some peformance tweaking and caching but does allow the search results to be filtered by node type and also filtered by author and date. It also allows sorting using different methods like relevance, popularity (view count) and date.
/search/messages/keywords
/search/videos/keywords
/search/messages/keywords?sort=by-date
/search/messages/keywords?person=author-name
Forum
We use the Advanced Forum module to assist with theming our Forum to look better.
We also modified further to allow a view count for each of the threads in the topic list
User Profiles
For our small but growing community we use the Advanced Profile module combined with Bio & Panels to allow our users to create a profile about themselves. It uses a content type that contains a selection of fields which for this third version we had to migrate from the regular drupal user profile fields.
Drop Down Menus
The drop down menus used on the site are currently a custom module which was created from various bits of code I already had for non drupal projects and then some routines i took inspiration from to convert it to work in drupal. It does however use the regular drupal menu system - in this case they are the primary links. I do plan to review the code soon and release it as a drupal module, but at the moment it is pretty site specific.
Future Plans
The next stage for this site is to build a book section, linking into the amazon affiliate system and combining it with a drupal based review system. We are also going to add the favorite nodes module.
We are also looking to review all the custom code for this site, and to see where we can improve and package them up to be less site specific. We want to use them on our own future sites as well as make them into (or contribute into existing) drupal modules.
Any questions or comments, please let me know :)
List of main modules used
thanks to all the authors and maintainers)
Content Construction Kit / CCKPathautoPanels 2ViewsEmbedded media fieldViews FastsearchImageImagecacheJavascript Tools (collapsiblock, tabs)
Tabs Panels StyleAdvanced ForumAdvanced ProfileBioFilter DefaultAdmin MenuDevBUeditorCalendar
FeedburnerComment PageComment NotifyComment Mover
Drupal version: Drupal 5.x