Drupal Planet

Drupal Camp Cork 2013 this weekend

That marvelous event of nature that only happens twice a year (no, it's not the solstice (or the equinox)) is upon us: Drupal Camp in Ireland. This time, we're off to the rebel county: Cork.

Although, the Dublin event usually has a larger turnout, we're expecting quite a good attendance in Cork this weekend, with about 50 registered so far on the official website and surely more to arrive on the day. Who's on the roll of honour? The biggest names in Drupal Ireland: Me (@markconroy), Stella (@snpower), Alan (@alanjosephburke), Gary (@manonmir), and of course the main organiser Ruairi (@Snakedog_101). So, basically, if you have a Drupal question or project that you'd like to discuss, one of us will surely be able to help you out - don't be shy.

And the topics (in order of what I am looking forward to:

You can read the full schedule here.

Did I also mention: LOTS OF BEER! - Looking forward to seeing y'all in Cork.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

Solution: Using AJAX with Drupal Views' Better Exposed Filters Module

You have a view listing nodes on your Drupal website and wish to use Better Exposed Filters as links that load in AJAX (perhaps inside a panel pane). Sounds simple? It should be. But ...

Click here for the but.

The problem is that AJAX doesn't work in panes when using the BEF module if the filters are exposed as links. There is a patch on its way to the main module, but in the mean time, I have solved this issue by doing the following:

1) Select Better Exposed Filters
2) Under BEF Settings, select checkboxes/radio buttons
3) Add some CSS to hide the radio button circles and style your filters

Now, it's not "links" but it functions the same.

Sample CSS:

.bef-select-as-radios .form-radio {
    display: none;
}

.bef-select-as-radios .form-item {
    display: inline-block;
    color: #ff0000;
    margin-right: 10px;
}

.bef-select-as-radios .form-item:hover, .bef-select-as-radios .form-item:focus {
    color: #ffff00;
    cursor: pointer;
}

Originally posted here.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

Drupal: How to Print a Pager for a View in a Block

Aaaarrgghh ... the Drupal mantra - "there's a module for that" - didn't hold true! There was no module. I had to come up with a solution; a solution to a problem that should have been simple (it was in the end).

I had a spec for a job to create image galleries of "our work", one node per image and 5 categories with about 20 samples in each category - so about 100 nodes. Each category was part of a dropdown menu (created using DHTML Menu module), whereby if you click on a category, it would show the first "sample work" image and a pager in the sidebar to scroll to the next item. Sounds simple? it did to me.

So, off I went looking for a "Drupal views pager in block module" using my favourite search engine! The closest I could find was the FreePager module - a great module - but it didn't suit my specific need, in that it could scroll through nodes, but I needed it to scroll through items in a view.

The solution? Here:

  1. Create the view with the five different categories.
  2. Add a "block" display to the view.
  3. Click on "Theme: Information" to see the list of possible views tpl files available for that block.
  4. Choose the most suitable one - in my case: views-view-work-gallery-block.tpl.php.
  5. Create a file called the above and paste in the given code.
  6. Remove the unneccessary code, in my case everything except the print pager section.
  7. Place this file in your theme directory.
  8. Place the block in your sidebar and hey, presto!

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

Drush Sup - Upgrade Site from Drupal 6 to Drupal 7 to Drupal 8

You want to upgrade your website from Drupal 6 to Drupal 7. The easy way!

You want to upgrade your website from Drupal 6 to Drupal 7. The easy way! This means, you've heard about the great drush command drush sup which acts like Pedro - if you vote for it, all of your dreams will come true.

How do you use drush sup or drush site-upgrade? Simple, open terminal (or equivalent), navigate to your home folder (cd ~) and enter drush dl sup. Viola, you've downloaded the site upgrade extension for drush. What's next? The easy part - create a site alias for your new version as told in the readme.txt, something like:


 

$aliases['newsite'] = array(
'root' => '/srv/www/dump',
'uri' => 'mynewsite.com',
);

You need to call this file aliases.drushrc.php. You can place all of your site aliases in this file in future. And then run drush sup @newsite (or whatever the alias you called it was) - and ... then ... it doesn't work. Why not? Well, because you didn't put the code above inside php brackets, like this:

<?php
$aliases['newsite'] = array(
'root' => '/srv/www/dump',
'uri' => 'mynewsite.com',
);
?>

Now it works. Go run drush sup @newsite. Did it work? No? Really? Why not? Probably because you don't know where to put the file. Simple (when you know the answer) - put it in side your drush folder, perhaps at ~/Users/yourname/dev/drush/ (there's an examples folder in there as well with some nice examples).

Now, run drush sup @newsite and Yee Haw!

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

How to Install Drush on H-Sphere enabled CentOS Server

Drush makes your Drupal life easy (well, easier).

Installing Drush is simple, for most people on most systems, but sometimes you get folks who like to have a control panel, such as H-Sphere. Nothing wrong with that, unless when you install Drush, you get the dreaded "can't find php" or similar message. What to do? Follow these steps after logging in to your server via ssh:

1 - Grad a copy of Drush and untar it in your shared folder

sudo wget --quiet -O - http://ftp.drupal.org/files/projects/drush-7.x-4.5.tar.gz | sudo tar -zxf - -C /usr/local/share

(Note, change the link above you the link to the latest version of drush on Drupal.org. You can do this by going to drupal.org/project/drush and on the download link, right-click and choose copy link location.)

2 - Create a symbolic link to where Drush can be found on your server

sudo ln -s /usr/local/share/drush/drush /usr/local/bin/drush

3 - Get Drush to auto download the required "stuff"

sudo drush

Drush won't work yet as it won't know where to find php, so

4 - Open your bash_profile file and edit the PATH line from something like this:

bash_profile: PATH=/hsphere/shared/bin:/hsphere/shared/sbin:/hsphere/local/var/vpopmail/bin:/usr/local/bin:/usr/local/sbin:$PATH:$HOME/bin

to something like this (note the php path in this version):

PATH=/hsphere/shared/bin:/hsphere/shared/sbin:/hsphere/local/var/vpopmail/bin:/usr/local/bin:/usr/local/sbin:/hsphere/shared/php53/bin:$PATH:$HOME/bin

5 - Reboot your server and YEE HAW!

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).