Multi-sites, theme customisation and modules in Drupal

I had a preliminary look at multi-sites in drupal, theme customisation, the category module and use of other modules to get up a microsite in drupal. I have taken the opportunity to make this a more productive exercise by using a real world example and used the naea.org.au site as the basis of my drupal investigation. The coordinator had wanted some changes made to the site which I had not got around to so thought I would set it up so that she could make them herself and look at how you would use drupal to set up a small website focussed on an environmental campaign.

I decided to set it up on the same install my ngogeeks.com site which I had originally upgraded to the latest 4.7.3 version of drupal. This would give me an idea of how you could go about running multiple sites on the same drupal code base. I set up the domain in my dreamhost account and switched the dns over to dreamhost. Dreamhost where doing some work on their servers and I had problems with the domain set up so had to leave it for awhile. I have pointed the domain to the same directory as ngogeeks.com. I guess this means that dreamhost will be setting up a virtualhost that will have the same root directory as ngogeeks.com.

MULTI-SITE SETUP

Here is a good forum post discussing multi-site issues in drupal http://drupal.org/node/82960. The way that it works is that when a request comes in for naea.org.au to the drupal directory /var/www/ngogeeks.com/ drupal, via the index.php file will look first in the ngogeeks.com/sites/naea.org.au and if it exists will use the settings.php file that I created in that directory otherwise it will use the one in the ...sites/default directory which contains my existing settings.

It is not going to be too simple to do what we want for tws as we would be looking at shared users across the different sites. Whether we would do it with shared user, users_roles, role table or use ldap I am not sure yet but for the purposes of naea.org.au the easiest way is to create a second database and in sites/naea.org.au/settings.php point to the new database. I created the naeadb and set up the naea.org.au/settings.php file.

The approach of drupal to share the users, table any other tables that you so chose seems like it is inherently going to be more complicated to manage and maintain than the way Plone/Zope can do multiple sites where you could just create an acl_users folder within your site object but I this is just my initial feeling and requires further investigation.

I created a sites/naea.org.au/themes and modules directory so that they are ready if I decide to create any custom themes or modules. I then added a number of themes I want to use to the main themes directory. Basically drupal by default will check specific directorys in a certain order and if it finds a theme or module in ../sites/naea.org.au/themes it will offer it for installation in the "Administer->modules" or "Administer->Themes" section. So you can easily customise themes or modules by copying them to the specific module or theme directory of the domain that you wish to use them for.

I switched to the box_cleanslate theme which is a nice simple clear theme and then configured the "General Settings" adding a name, slogan, vision and footer for the website.

SETTING UP MODULES

I then looked at the modules. I wanted Categories to make it easy to structure the site, clean urls and WYSIWYG editing and I thought I might also add an image module so that Jacq could create galleries of any meetings they might have.

I also installed the following modules which integrate in with tinymce:

linktocontent - makes it easy to link to content on your site through tinymce.

map - basically google maps but with a map selectory integrated into tinymce.

I also downloaded the views_bonus module but didn't install it yet. It offers a set of default views so might be useful for the ngogeeks site and for the tws site. Basically views look like they let you create dynamic views of content.

I then went through and enabled the module.

Firstly I did the category module on its own and then afterwards the other category modules which require the base one.

I went through the modules one by one to make it easier to track down bugs rather than just enabling a whole heap in one go.

CONFIGURING THE CATEGORY AND OTHER MODULES

I just focussed on getting the category modules working first so I could set up the structure of the site and put the content from the old site into it.

The first thing was to got to Administrer -> Settings -> Category and Install the taxonomy wrapper so that I could use the taxonomy dependent modules. Also it stopped me having to categories listed in the Administer menu. I was not interested in using the book module so left it disabled.

I created a "content contributors" role and gave them permission in the category options.

I then started working through the category tutorial after creating a story just so that there was information on the front page saying that the site was being rebuilt.

Installed flexinode so that I could easily create node types other than the default story or blog type. Flexinode looks like a very useful tool. I guess it is something like plone's archetypes but I haven't had a good look at that yet.

I created an article type based around the current tws campaign update type. So it just had an abstract, image and body associated with it.

It appears that the help on the flexinode article is broken. Looking at the flexinode page apparently they haven't released any form fields for the flexinode module yet so although although you can all these fields that you can add they don't actually work yet. The documentation for flexinode appears to be non-existentso I thought I would call a halt to looking at it for the moment and look at other options.

It also appears that you can't actually delete a content type when you have created it or least not that I could see.

I uninstalled the module which got rid of the content type I had created using it. I found mention of the CCK module which looks similar to flexinode so will investigate that later.

TINYMCE

I installed tinymce and also set up the tinymce_compressor according to the install instructions. The compressor is supposed to reduce the size of tinymce by 75% which speeds up page loads.

I had to enable the "Full Html" Input format as the default one strips all the html out of the TinyMCE editor so it is a bit pointless to try and use it if you are going to have the tinymce editor unless you take the time to match up the tinymce allowed tags with drupals input filter.

I changed the "Full HTML" to be the default format for the content contributors group.

CUSTOMISING A THEME

I then spent a bit of time playing around with the box_grey/box_cleanslate theme to get the design and layout that I wanted. You can change things like logo and basic stuff through the web interface but to make other changes you need to edit the style.css file in the theme. Using the firebug extension for firefox I identified the elements I wanted to change. Main thing was adding a background image for the header block and some menu style customisations.

I set up the Primary links so that the "Edit Primary Links" that you see in an initial drupal install shows my primary natigation structure. This gives me the main links in my navigation appearing underneath the banner. To do that just go to "Administer->Settings->menus".

I removed the login block so if you want to login now you go to www.naea.org.au/user to see the login page.

I wasn't using the category module in the ngogeeks.com site so by enabling the wrapper for taxonomy I had wiped my drupal site, well stopped it from displaying as it choked when it tried to load the taxonomy module. To fix this I had to copy the new taxonomy wrapper to the sites/naea.org.au/modules and the old one to sites/default/modules and remove taxonomy.module from the ngogeeks.com/modules directory.