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:

  1. Simple panel pages such as the homepage, these contain a selection of blocks, views and mini panels.
  2. 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
  3. 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
  4. 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 / CCK
Pathauto
Panels 2
Views
Embedded media field
Views Fastsearch
Image
Imagecache
Javascript Tools (collapsiblock, tabs)

Tabs Panels Style
Advanced Forum
Advanced Profile
Bio
Filter Default
Admin Menu
Dev
BUeditor
Calendar

Feedburner
Comment Page
Comment Notify
Comment Mover

Comments

Michelle’s picture

The site is beautiful and a great showcase for panels. Thanks for writing this up in detail.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

JohnForsythe’s picture

Site does look good, but is this supposed to be on the front page?

--
John Forsythe
Drupal Modules - Find the module you need for your project!

Michelle’s picture

We like to promote posts that detail how a site was built. It may not be as flashy a write up as the popsci one, but it's worth showing off how smaller companies / individuals can build nice sites with Drupal.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

BryanSD’s picture

+1 for putting this on the front page of drupal.org. It is nice to see a little bit of "how-to" on the front page for a change. Announcements are nice, but this post helps inspire.

I really like the mix of views/panels on the "author pages". I'm also curious as to how the users of the site handled the Plone to Drupal experience...

-Bryan
CMSReport

smoothify’s picture

I will try to include some information about the migration from plone in my updated write up, but the main module I used was Import HTML.

First i created the CCK types to match those i had on the plone site with the correct fields. Then on the plone side i created some templates that outputted the fields in simplified html, so it was easy to parse the fields and fieldnames. Then i used wget to save the entire site to disk keeping the folder structure the same as the url structure.

Back in Drupal in Import_HTML, I then chose the default content type i wanted to use for the import and gradually did section by section (otherwise i ran into memory errors). In total I had over 1500 messages to import and apart from a few things that needed tidying up it went pretty smoothly.

nirbhasa’s picture

Guided by your inspiration, I am also trying to migrate Plone sites to Drupal using the Import HTML module (which truly is a wonderful, wonderful module). So far all pages are importing OK, but the page title isnt being picked up with the default XSL template that Import HTML provides (all pages just have the site name instead). Im just wondering did you create a special XSL template to handle migration, and if so, perhaps you can share it..... I and busy learning XSL now and will probably get the answer soon, but if a couple of days can be saved then great, life is short after all....

smoothify’s picture

Sorry for the delay in replying, I didn't use XSL templates actually.

I simply used the regular HTML from plone, but in the plone template I wrapped the fields i needed to import with span tags so Import HTML could work out what they were.

One reason for this was i wanted to makes sure i kept the urls exactly the same on the new sites and we were only importing one main content type. If you are needing to do a more complete import then XSL may be the way to go.

Good luck with it!

Ben

Francewhoa’s picture

+1 for putting this on the front page of drupal.org. Great website.

Loving back your Drupal community result in multiple benefits for you  
smoothify’s picture

Michelle,

Thank you for the compliments about the site and for promoting this to the homepage!

It was a lovely surprise to see it there! If you feel it would help i'd be more than happy to expand and tidy up the write up,

Thanks for your Advanced Profile & Advanced Forum modules by the way, i found them very useful both in terms of what they could do and also understanding the way you did it helped me learn a bit more how the forum and panels modules could be interacted with.

Many Thanks!

Ben

Michelle’s picture

Glad you found them useful. If you could expand/tidy up, that would be wonderful. Just attach it as a comment and I can edit the original post and replace it with the updated version.

Thanks,

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

smoothify’s picture

I've been working on an updated write up for the site with a little bit more info and more links to the modules used.

http://spiritlibrary.com/writeup/sl_writeup.html (html with images)

http://spiritlibrary.com/writeup/sl_writeup.txt (no images - and no paragraph tags)

It would be great if you would post it for me Michelle, but i'm here to make any changes to the format if you need it.

Michelle’s picture

Original post updated. Thanks so much for taking the time to expand the writeup. It looks awesome! The baby's crying so I'll have to read it later but it looks very thorough from a quick look.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

mlncn’s picture

Linking to the modules used for that extra bit of polish would be nice. Sharing the techniques in the custom views code would be really nice!

benjamin, Agaric Design Collective

benjamin, Agaric

jeff h’s picture

Hi,

Nice site! Mind me asking how you made the right-hand-side "Filter Results" block on the search page? Are you purely working with the URL arguments in this, or is it more cleverly-integrated with Views somehow?

Thanks,
Jeff
________
Drupal Development,
marmaladesoul.com

smoothify’s picture

For the filter blocks I didn't use the Views arguments at all, Instead i actually add filters to the view programmatically.

The argument handler in the view calls a function in a custom module, that parses the url arguments and query string and decides what information needs to be shown, how it should be filtered and what the sort order is.

Then it adds the required filters and sort methods to the view and if necessary changes the view layout before emptying the $args array and returning.

ggevalt’s picture

Regarding your explanation on the filtering, do you have a more detailed explanation somewhere? And what do you mean by "custom module" is this filtering system, essentially, a custom module you created?
thanks

geoff gevalt
http://www.youngwritersproject.org

themegarden.org’s picture

Nice work.

In list of used modules, you haven't mentioned any module related with your nice drop-down menus.
What module have you used for that menu?
---
Drupal Theme Garden

ipwa’s picture

I was going to ask the same question, some details about what you used to make the drop down menus would be great.

Nicolas
-------------------------
http://nic.ipwa.net

Nicolas
-------------------------

joep.hendrix’s picture

Great write up, thank you!
What I would like to know is why you moved from Plone to Drupal. At the time we neede to choose the CMS we wantet to offer to our customers, Plone fineshed second after Drupal. The technical server requirements made us decide to go for Drupal.

Please let us know why you migrated to Drupal. Since it is a lot of word to migrate all data, you must have had good reasons to do so.

Thanks!

-----------------------------------------
Joep
CompuBase, Drupal websites and design

-----------------------------------------
Joep
CompuBase, Dutch Drupal full service agency

smoothify’s picture

I've covered Plone a little bit more in my expanded write up but the main reasons were:

  • Taxonomy Although we aren't heavily using the tagging on this version of Spirit Library, it is something that we are going to expand on the site and plone just didn't have a comparable system
  • Wider Range of add on modules Because Drupal is more accessible due to the server requirements, it has a great and active collection of modules. I found many Plone ones inactive and unfinished, especially in the blog, commenting and forum areas. Projects tend to get prioritised (quite understandably) based on commerical projects that the module developers have at the time
  • Memory:, Some people say Drupal uses quite a bit of memory, but while its not a good idea to use it on a small shared account its great in comparison to Plone! The Zope Daemon uses about 200MB + continuously, but then keeps growing until usually it needs restarting.
  • Disk Space: the ZODB (Zope Database) that Plone uses was expanding to a huge size, often would reach over 2gb . (In contrast the entire drupal database for the same site now stays around 100mb to 200mb.), The reason for the huge size it that Plone/Zope tracks all the changes so you can undo steps and usually you can 'pack' the data and reduce to a normal size. However it kept becoming corrupt which meant until you fix the file you can't pack it.
  • More flexible url structure. Plone has nice URL's 'out of the box' but I found it all a bit rigid - you need to keep everything in a folder system, which is useful for some sites, but felt a bit restrictive to me.
  • I found Drupal is much easier to develop with. You shouldn't really develop on the live production site with either system, but drupal makes it easier to carry out minor changes using CCK and Views. Also because of the file size and memory issues it is a pain to set up a development server in Plone unless you have a powerful server that can cope with two instances. Even after you have it set up you often need to restart Zope between file changes which can make simple changes time consuming.

It was quite a bit of work migrating from Plone, but it was something I felt worthwhile as after a couple of years of doing Plone sites I felt like it was time for a change myself as well as this site. Plone itself was starting to go in a new direction which meant lots of new learning, so I just decided to go for it. And looking back it was certainly a good decision, and i'm much happier now working in Drupal for this and my future sites.

joep.hendrix’s picture

Thanks for your detailed explanation. There are probably not a lot people out there that have experience in both systems.
Your comments above would be really helpfull for others when they are at the point choosing one or the other CMS.

BTW: I am glad we went the Drupal way!

-----------------------------------------
Joep
CompuBase, Drupal websites and design

-----------------------------------------
Joep
CompuBase, Dutch Drupal full service agency

beckyjohnson’s picture

I really love your theme! The layout and colors are really beautiful and soft.

I was wondering, how did you configure your breadcrumbs? Did you just use primary and secondary links to make a parent/child relationship to them? I just wondered because on my site I have a lot of custom navigation menus that only show up on certain pages and those custom menus are supposed to in theory be children of certain primary links. Like for example: About is a primary link but then in the custom menu for "About" there is 3 or 4 links that are supposed to be it's children. Unfortunately the breadcrumb feature doesn't see it that way and doesn't read these custom menus as children of the pages they are displayed on.
Er...sorry to ramble but any insight would be helpful...

Becky.

smoothify’s picture

Hi Becky

Happy you like the site :)

Since I was already creating custom modules for many things on the site, I made a custom system specially for Spirit Library so i could create the right breadcrumbs for each page.

However there is a good module that really improves on the default drupal system - http://drupal.org/project/custom_breadcrumbs - I looked at this but it didn't quite do what i wanted, however it might work for you.

Ben

beckyjohnson’s picture

Thanks for the suggestion. I will try it out. Thanks for replying.
Becky

portait’s picture

Congradulations!!! Your site looks really different (better) than most drupal sites. ;)

sirkitree’s picture

I especially like the section about doing your migration.

~Professionally: Sony BMG - myplay.com
~Personally: sirkitree.net | drupalmao.com


~Professional: Lullabot
~Personal: jeradbitner.com

Memeshift’s picture

Thank you so much for the site write up!

This is a great article and thank you so much for taking the time to do this. It sounds like you did most if not all the work on this site yourself. Kudos!

Morgan Sully
Online Community Building
Digital Storytelling
Electronic Music
www.memeshift.com

"If you have knowledge, let others light their candles in it." - Margaret Fuller

Fayna’s picture

This is really wonderful, thank you :)

websitetraffic’s picture

This new panels look pretty and they are going to improve the functionality of the web site.

Get more internet traffic with Traffic Kahuna

willk’s picture

The site looks great. I am fairly new to programming and Drupal, and seeing you switch to PHP from Python is rather surprising because I was under the impression that the latter was one of the “it” programming languages. There is a lot of literature out there about how large PHP sites require a better back end (preferably Python and maybe PERL) in order to handle large amounts of data effectively. Since you are obviously experienced in this field, can you expound on this based on your experience. With sites like yours, I think it is clear that PHP combined with a powerful CMS like Drupal can play with the big guys. Thanks for the post.

smoothify’s picture

[monty python quote]
Is this the 5 minute argument, or the full half hour?
[/monty python quote]

I do like the Python language (and Monty Python too :-) ), but I did also have lots of experience in PHP too. I don't want to get into which language is better as I think its really an individual choice, but when comparing something like Plone and Drupal there is much more than the language they are written in.

They are both big systems, and in Plone's case it runs on Zope which runs on Python which adds another level into the equation. For my needs i just found that drupal worked better,

I think any system can be made to scale with the right hardware and system design - doesn't facebook run on php after all?

MrCaase’s picture

The site looks amazing, great work!!

Witch’s picture

Congratulation. This site es well to read. I like the design very much.

navi-tipps.de

bigkevracer’s picture

Great writeup, site looks fantastic. Well done!

One thing I was wondering though was with the videos, what did you do to so neatly integrate them?

One of my sites I want to add videos, and make it so that users can create their own videos simply by posting the YouTube link. I take it this is how yours work?

Any further information you could provide would be greatly appreciated! Thanks!

smoothify’s picture

This part is actually very easy using the excellent module Embedded Field / emfield

It does then give you a field where you can enter the youtube link (or even google video, brightcove, plus plenty more) and it does all the rest. If you have a youtube api key it also handles the thumbnails for you and integrates with views.

purrin’s picture

thanks for the breakdown.. this sort of thing really gives some insight to those of us aspiring to be drupal theming ninjas one day! :P

-=- christopher

socialtalker’s picture

i love the spiritlibrary and your home site, you have a wonderful talent for colors, i felt very good just looking at the pages, the drupal site is beautifully designed a wonderful concept for a portal. congrats

smoothify’s picture

Thanks every one for your lovely compliments! - they are really appreciated ! :)

socialtalker: if you meant our radiantflow site, although very simple in comparison, that is also a drupal site. Happy you like both sites! We do put a lot of time into choosing the colors for our sites so its lovely to hear you feel good looking at them!

wflorian’s picture

Your Drop Down Menu ist absolutly great. Would love if you could share it soon!!

smoothify’s picture

I will try and see if i can package this up soon, in the meantime if you need a menu system you might check to see if Nice Menus can work for you.

giggler’s picture

You mentioned using CCK to create groups...so that means you didn't need to use OG for this? How did you create groups and then associate the users to the groups? OR are they just completely separate?

Nice site overall and nice profile setup!

smoothify’s picture

When I use the word groups for this site it has a different meaning to when its used in Drupal/OG.

For my usage its nothing more than a container for a set of messages and authors - it doesn't need the features of OG.

rahim123’s picture

I assume this is a Drupal 5 site?

smoothify’s picture

Yes the site is Drupal 5 since it uses a lot of modules.

ggevalt’s picture

You've done a great job with this site. I am particularly interested in the way you have integrated the content. That would be extremely useful for us as we attempt to build some better organization with our own sites which are getting quite large.

I am interested in several things.... One is the way you use filters and arguments and, apparently, a custom module, to help the user sort and search. In our primary site this would be extremely useful but in our other, customized sites, it would be critical.

To explain, we operate Web sites to help students write. On our primary site we have upwards of 25,000 pieces of student generated writing, several thousand static pieces by us (tips mainly), about 3,000 forum entries and about 35,000 comments.... We are looking at really developing our tag system to allow for both required choices and freetagging as a better way of helping students see the genres they're interested in.... Your sort system would add to the useability of such an organization model.

Our customized sites, meanwhile, are integrated into the classroom; better filtration and search would allow students and teachers to look at individual students' porfolios, common assignments, and genre types. I think it also might allow for some organizing of individuals' overall comments....FYI, a lot of teachers require their students to do a certain type of and quantity of commenting on other students' work....

ALSO, and I'm sorry to go too long here.... Did you use panels2 with a set theme or did you design the theme yourself? Can panels2 be integrated into another theme?

Would love to also see how you did drop-down. I'm presently using a modified Ropple Theme that has wonderful drop-downs but I'd love to be able to modify them....

Anyway, really good work and thanks for sharing it with the Drupal community.

geoff gevalt
http://www.youngwritersproject.org

smoothify’s picture

Geoff

Regarding the Filter system, i would love to package it into a module, but right now its not totally clear how to turn the site specific code into something much more usable and adaptable.

I have had someone contact me today also interested in this, and possibly sponsoring some of the development of this module to speed things up a little. I'd like to do it anyway, but since i have several active projects at the moment it would certainly help.

Regarding the drop down menus, i noticed you had some on your site - what are you looking to edit, the menu items or the visual side?

ggevalt’s picture

Thanks so much for responding. And again, nice work. Regarding the module development, we may have a little scratch to help but right now we are seeking funding for continuation and expansion of our work. If we're successful, we'd love to talk to you about it; whatever help we could be would be modest.
My interest in this would be to build a powerful filter system that would allow students and teachers to create comprehensive individual portfolios of work -- blogs, podcasts and various forms of nodes as well as comments. Commenting is a very important part of our primary site as well as our school sites and it is very difficult to sort the comments; there is another module that helps sort comments by user, but it has some limitations because it is tied to profile access. Also, I'd love it to all be in one place in a portfolio page.

Which gets to the drop down question....which is really related to using panels2. Can panels2 be used with any theme? Or do you end up creating your own theme when you use it?

Anyway, I really appreciate your efforts and I don't want to tie up a lot of your time to answering my questions. Glad you took a look at our site....

geoff gevalt
http://www.youngwritersproject.org

smoothify’s picture

As Michelle mentioned below, panels2 is a module rather than anything related to themes.

The output from the panels module is within the content area of the site, so you have your regular header, navigation menu and footer, then in the middle you get the panels.

The great thing about it is it lets you create complicated multi column layouts and you can drag 'n drop different elements such as nodes, views and blocks around the page. It has a couple of stylesheets - but they are only used to manage the columns and rows you need.

So yes you can use it with any theme, its completely independent of themes. Once you've set it up you might want to theme its output like you do any other module but its not necessary.

Michelle’s picture

"Can panels2 be integrated into another theme?"

Panels 2 can be used with any theme. It's a module, not a theme.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

rainmist’s picture

Very nice!!! I have a question. How to add content links to user profile?

smoothify’s picture

If you are asking about how to create the list of topics a user has participated in on their profile - then the answer is through the Advanced Profile module.

That uses Panels to allow you to show all sorts of info about the user. I also use the Bio module to allow custom fields.

JMowery’s picture

I really do enjoy posts like these. Keep 'em coming!

spiritual artist’s picture

Nice, this spirit library, I am very curious to take a look. I was a long time looking for something like this, sometimes not so easy to find good spiritual resources on the net.

I sincerely hope that this one will keep on growing :-)

See you later,

Steven - Belgium

Rustan’s picture

Thank you! A well-written and interesting walktrough of your site.

Huth-1’s picture

This is a cool site!!

Thank you for the detailed write up! I loved the colours and the design too! :)

SocialNicheGuru’s picture

subscribing

http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.

lunk rat’s picture

I clicked the "Subscribe to email" button at the top and got this:

Warning: Duplicate entry '182077' for key 1 query: INSERT INTO sl_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN sl_node_access na ON na.nid = node.nid LEFT JOIN sl_node n ON node.ni' at line 1\nquery: INNER JOIN sl_node_access na ON na.nid = node.nid LEFT JOIN sl_node n ON node.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'forum_access'))) AND ((n.moderate != 1 OR n.uid = 0)) LIMIT 0, 12 in /var/drupal/drupal-production/includes/database.mysql.inc on line 172.', 2, '', 'http://spiritlibrary.com/daily-updates', 'http://spiritlibrary.com/about/about-spi in /var/drupal/drupal-production/includes/database.mysql.inc on line 172

Wish I knew how to help.

smoothify’s picture

Thanks for the report. This was a problem with the watchdog table, and needed repairing in phpmyadmin.

smoothify’s picture

I've made a few additions on the site now, the popular messages view was a bit limited as it was quite static, so I wanted to create sections for popular messages today, this week, this month etc.

One way i thought about was to filter the messages by when they were posted, so it would show the popular messages posted this week for example. However this would miss out on situations where an older message gets a surge in traffic for some reason (linked somewhere else - or topical for some reason).

So I created a module which after a bit of tidying up I should be able to release on drupal.org. At each cron run it calculates the views for each node within different time periods - 24hours, 7 days and 30days. These counts are then made available within themes and I also created a set of views handlers for them.

You can see the result embedded in some tabs on the homepage of Spirit Library.

Since thats quite a few extra queries on the home page, I've used the caching abilities of Panels 2, which allows setting the expire time of each tab individually. For example all time popular doesn't need to be updated often so can have an expire date of 24 hours, where as Latest messages needs a much lower setting.

amedjones’s picture

hey thanks for the post, if I came across your site through different method, i wouldn't have guess it was powered by drupal. I love what you did with the layout, the customization and the mixtures of all the modules to create a professional unique site. Websites like your always inspires me (and im sure others) to keep working with drupal and unlock it's full potential. keep up the great work :)

And thank you drupal for posting this to the homepage. Posts like this one acts as an encouragement for all Drupal enthusiast and new comers to continue supporting this project

smoothify’s picture

we've found developing in drupal a great thing, it really make creating very cool sites much easier :)

I agree the regular showcases on the home page do give a great insight on how others create their sites.

ipwa’s picture

I noticed that a lot of modules where used for this site, and they seem like pretty hungry modules. Can you please give us some details on how you optimized the performance of your site? What kind of cache did you use? What kind of server is the site hosted at? How many queries do you get on an average page? I would really appreciate the answer to some of these questions, as I'm having some problems with Drupal's performance, and would love to hear how different sites have tackled this issue.

Regards,

Nicolas
-------------------------
http://nic.ipwa.net

Nicolas
-------------------------

smoothify’s picture

I do plan to do further optimisation on the site actually, as i've only just started with the improvements. Its always a balancing act getting the blend between features and speed.

We run the site on a high quality 768Mb VPS along with 10 or so smaller sites, and it copes very well at the moment. The site is getting busier and busier though so I do want to improve things as the CPU can average around 40% usage on busy days.

I don't have the figures for query counts but we have been able to reduce the number through our use of the caching system in Panels 2. That lets you choose expire times for each part of the page (we use panels for most areas of the site). For instance on our home page the whole tabs area is cached for a few minutes, then within that each of the tab panes is further cached with different expire times depending on how current the data needs to be. Currently only certain areas of the site use this, but i plan to extend further.

We don't use page caching, because we like the view counts to be updated regularly and it always seemed a bit unpredictable when pages would update.

Not really related to queries, but i did need to work on the css and js aggregation, as they weren't ideal. Since many pages used different modules all with different css / js, i had a situation where pages shared around 90% of the same additional files.

The aggregators work by compiling a list of all the files needed and then creating a code for them using md5 which becomes the aggregated filename. This does mean if there is any difference in the list of files, or even in the order of them then it results in a different filename which means an extra download. So it meant for each section of the site there was a separate 60k css file to download - which clearly wasn't ideal.

In the end I just made a list of all the css files i needed for all the sections, and then in the menu hook of a custom module i just manually added these through the drupal_add_css function before other modules could. This way i could ensure that every page would use the same aggregated files. It meant for some pages more css was loaded than necessary but it was worth it since we only needed one file throughout the site.

bigkevracer’s picture

I know a few people have asked about the menus already, but is there a reason why you wrote your own as opposed to using something like DHTML menus?

I'd like to implement similar menus in my rewrite of sarally.com.au, and the layout is now finished, I just want similar menus to that now. Has anyone implemented anything similar and can suggest a module?

I'd like to be able to define the contents of the menu through the admin interface too.

Thanks,
Ryan

www.sarally.com.au | www.puregrandprix.com | www.ryanjones.com.au

mysty’s picture

While for you it's probably simple code, would you consider posting the content of your 'css files preloader' module?

I really enjoyed this write up and reading all the comments/answers.

The site is a fabulous example made even more real for aspiring drupal developers with this case study.

Thanks again,

mysty

smoothify’s picture

I did try to put the code in the template but it wasn't getting called early enough so I used the hook_menu in a module instead.

The code is specific to what i need for my site but it should give you an example once you've decided what stylesheets you need.


function modulename_menu($may_cache) {
  if($maycache) {
    
  }
  else {
    drupal_add_css(drupal_get_path('module', 'smileys') . '/smileys.css');
    drupal_add_css(drupal_get_path('module', 'tabs') . '/drupal-tabs.css');
    drupal_add_css(drupal_get_path('module', 'tabs') . '/tabs.css');
    drupal_add_css(drupal_get_path('module', 'node') . '/node.css');
    drupal_add_css(drupal_get_path('module', 'comment') . '/comment.css');
    drupal_add_css(drupal_get_path('module', 'panels') . '/layouts/flexible.css');
    drupal_add_css(drupal_get_path('module', 'content') . '/fieldgroup.css');
    drupal_add_css(drupal_get_path('module', 'forum') . '/forum.css');
  }
}

mysty’s picture

I'm guessing that you created your site specific module with a low weight that causes it to be loaded pretty early on, and that the above approach is compatible with the admin > settings > performance > 'aggregate and compress CSS files' option?

There seem to be a number of comments about modules' respective CSS additions becoming quite a pain to manage, so your approach can I think help quite a lot of people, especially as the number of visitors, modules and - last but not least - customisations goes up, for any site.

Perhaps someone with more brain cells than I (the majority) can figure out a way to generalise this approach, so that all complaints about drupal are eliminated for good ;-)

Even so, the above will I believe be pretty useful, so many thanks again!

mysty

smoothify’s picture

Yes the module does have a low weight of -1, which can of course be set in the install file or using moduleweight.

It is compatible with CSS aggregation and in fact thats the reason i did this. The list of css files is actually longer than the one i showed on here, and i found the situation where the main page types of the site shared 95% of the CSS. However the 5% of difference caused a different aggregated css file to be created for each area of the site, which meant going to the site and viewing 5 pages or so might need you to download 5 different 60k + css files.

All my code does is ensure I have the same list of CSS files, in the same order for the vast majority of my pages, which means just a single aggregated file.

I do agree that CSS in drupal needs more thought to working out better ways to manage these files, i think the best approach would be for a kind of registry system that modules add their css to at install time. Then files can be grouped depending on their display conditions, i.e. whether they are shown only on nodes, or panels etc. Plone has a system similar to this, and while the interface wasn't great on the whole it worked pretty well.

secgeek’s picture

All i can say is woooow.
cool site with nice features.are you using a custom theme?

www.secgeeks.com
www.newskicks.com

smoothify’s picture

Thanks, yes it is a custom theme which we keep improving and updating.

For new projects now i always start with the Zen theme, but when i started this I wasn't aware of this so I did it a harder way!