Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

Boost and Varnish and general tips and rants about Drupal caching

This topic has always been a big pain in the ass for me. Drupal takes a lot of resources, which means money for hosting, you should at least have VPS to have some decent hosting for drupal, but not to have OOMing and high CPU usage all the time, you should use different caching systems.

Boost

Varnish help

So Varnish is really good caching thingy if you use drupal (or other stuff) so to see what it is doing and how, you can login to your server and try this commands.

varnishlog - See what Varnish is currently processing, you will get complete header info I think

varnishstat - Shows various information about varnish

Add UTM tag to links, so other people know when users come from your site

So this is some marketing stuff I do, but it is useful. When you click a link on some site, to give some message to that site and owner or whoevere is taking care of marketing you can add some UTM tags to links so in their google analytics they see that message. So what do we do is I use display suite, create custom code field and use entity data to make new fields that look like this:

Removing a link from Webform block

If you display your webform as block and then also use Full Node view in block settings, you will have a title that leads to the webform itself. Probably you don't want to do that. But what to override, it's kind of simple, just override node--node_id.tpl.php as this is in the end a node display and remove link from h2 tag. That is all.

Theming Ubercart Order Admin or uc_order-admin.tpl.php

So this one is rather old in 2013. But then again Ubercart and E-commerce are slowly getting up to speed with drupal 7 so still many sites use Drupal 6 for web shops. Anyhow, what we wanted to do is add some extra information to emails sent after order. Ubercart has a way of sending nice HTML emails to clients and obscure plain text emails to admins.

Setting a drupal 7 Multisite to localhost

Without a powerful server drupal administration online is very slow. As I have a multisite online, for some bigger changes I decided to take it offline to localhost and try to build/change things on my computer an then upload DB online. But first I needed to configure my localhost to work with multisite.