Jun 21 2012
Jun 21

Increasingly our web pages are being bookmarked on iOS devices.  This is a good thing, however we had traditionally been using long titles on our pages and these were clumsy for end users when trying to store bookmarks.  Like 90,000 other websites we have chosen Page Title to solve this issue.  It works well with Tokens and Views and is probably one of those modules you should just install.

Here’s your 1:30 video http://www.youtube.com/watch?v=DMvXVJ2mbGQ

and a couple of screen shots for the really curious types.  It’s a simple module to install and use. Made by several of Drupal giants robertDouglass, JohnAlbin, and nicholasThompson.

Turn on page titles in the content type area

Turn on page titles in the content type area

Enjoy refreshing page titles independent of your content title

Enjoy refreshing page titles independent of your content title

Apr 16 2012
Apr 16

The more I use the activity module the more I like it.  It is a simple module that does one thing well = it keeps track of what is happening on the site, and it leverages other modules like core Triggers, Views, and Tokens to create a useful intuitive activity page.  In our use case we wanted to have the ability to track certain roles working with certain nodes – and having the output styled in views is just icing on the cake.


To start with you’ll need to go to /admin/build/activity/create and add activity templates.  Because of how this module was designed I believe it would be pretty simple to extend this module to monitor almost anything.. we just needed to know when certain roles updated or created certain node types, so that was pretty simple.

Setting up an activity template

Setting up an activity template

The use of tokens in the message display section makes for readable and useful messaging

Add tokens for readability

Add tokens for readability

After creating your template(s) you now need to go over to views and add an “Activity” type view – here again – it’s just so cool that you’re extending what is already there and working well… it just makes for an easier time + one less thing to learn!

Adding the Activity in Views

Adding the Activity in Views

With the View going the rules are pretty much the same as for all views – it’s worth noting that if you want to filter by User Role you’ll need to add the “Activity: User” relationship – this adds all of the typical user fields to your filters as well as your fields.  Likewise if you need more information on the nodes you may add the Activity: Node relationship – it’s not always that important since many of the information may be stored in the tokens.  It’s nice to know that you may access those fields if you need to though – just add the relationship and fields + filters as desired.  Nice work on this module folks = well thought out and well implemented.  Thanks!

Setting up the activity views

Setting up the activity views

The final outcome = another view

The final outcome = another view

Mar 28 2012
Mar 28

Views field view allows you to pass an argument to a view and return results.

For the video inclined here’s the 2 minute feed http://www.youtube.com/watch?v=dUoL_ARPLcI

Use Case:  we’ve got a lot of variables being tallied in different views.  Views in general seems an awkward tool for tabulating values.  Tools like views calc and group by work ok for getting a sum or count here and there, but try mixing several together in one view and the errors start to fly.  May just be I don’t have my head around them, in any case they are not intuitive.   For a given organic group node I need to know how many posts there are total (not a problem, that field comes with organic group views integration), and how many of these posts have been completed in a certain way.

Views field view added to fields in view

Views field view added to fields in view

Choose a view and add fields from the view as argument tokens

Choose a view and add fields from the view as argument tokens

Creating this separate view is simple, but now I want to link the main view to the small view tally.  Views Field View let’s you pick a view and pass it an argument to filter the results per row.  In this case we load a node id into our main view and pass the argument over to the Views Field View – creating a new field with the correct info on a per row basis = Nice!

The only thing that doesn’t work is that it does not actually load this view in the order the rows are listed.  Because of this it does not work well with Views PHP.  Although the rows are listed in this global php field the actual data is not available because for some reason the field is not loaded in the order one might imagine it to be.   It’d be really handy to be able to use these variables in calculations, however it’s just not obvious at all how to do that.

Views PHP and VIews Field View don't work together

Views PHP and VIews Field View don't work together


Feb 24 2012
Feb 24

Create a rule set and add an argument to receive from your view

There are numerous ways to clean up old posts. Node Expire + Rules is one way, however it requires the user to specify an expiration date, another module, and in that sense is neither intuitive nor efficient. Using Rules and Views together via rules + views integration there’s a great way use the data that has already been entered.

For the video folks here’s your 2 minute rundown of what is up:

1) Create the rule set to handle the data. Add a content argument – you’ll be passing the node ID’s over to Rules for the actions to take place

2) Inside the rule set add a rule – no conditions are needed, just add the action to unpublish the nodes

Here's what your final rule should look like

3) The final rule should look similar to the image at right

4) Once you’ve got your rule set up it’s time to create the view that will send information over to the rule.  Assuming you have rules + views integration and Views Periodic Execution installed you’ll now be able to execute your views on a cron tab

5) In views you’ll need to set the periodic execution phase, the rule set, and of course set up your filters as per usual and MOST IMPORTANTLY include the NID (so that rules knows which nodes to act on)

Select your rule set and pass the node id for your argument

6) The Views Periodic Execution mod by Stephen Jones aka darthsteven

Set the periodic execution phase

7) and of course you need to choose the rule set unto which the little nids may argue and achieve action.  Once you pick your rule set the available arguments’ll appear – any fields you have elected to have appear in your view are available to activate the rule.

Create a rules executor view and send it to your rule set
Feb 16 2012
Feb 16

Autocomplete for apachesolr views

For the folks who need a working copy of apachesolr autocomplete for use with apachesolr views here’s a repo that’ll help https://github.com/alibama/apachesolr-autocomplete-drupal – bear in mind that it’s just the latest version with patches #13 & 14 listed in the autocomplete issue queue applied.  Just figure it’ll save someone a minute of testing against the latest version of solr views…   It’s also attached in a zip at the end of this post.

Also in today’s two minute vid:  exposed form filters in a block = a great way to handle site search.  The exposed filters become available as a separate block that then points to the page.  We then take the newly created block over to our sitewide context and have a search box on every page that connects to the apachesolr search view….

Exposed form in block

Sitewide Contexts put blocks on every page...






Apachsolr Views Autocomplete Module

Feb 13 2012
Feb 13

Goal: Improve User Interface for our 10,000+ list of electronic resources.

Solution: When working with long lists  a good UI makes all the difference. In our electronic resources catalog the Views Autocomplete Filter module allows patrons to filter through thousands of titles in a few clicks. Views Autocomplete Filter works in much the same way as Better Exposed Filters (and I wish there were some way to have both filters in the same view – if anyone reads this and has a thought on that it’d be greatly appreciated…). For the videophiles here’s the two minute review

Views Autocomplete Filter



Oddities: The only problem was we got a stinking HTTP 0 error if the patron tried to apply the exposed filter before the site came up with a suggestion.  http://drupal.org/node/627834#comment-2398782 is a pretty straightforward workaround to log errors to a log instead of to the user’s screen…we don’t really care, in our case final fix looks like this


commented line 284 of webroot/misc/autocomplete.js
error: function (xmlhttp) {
//alert(Drupal.ahahError(xmlhttp, db.uri));

and with that we achieved greater happiness, and all was better in the realm.

For Drupal 7 Autocomplete Deluxe looks pretty nice as well…

Feb 08 2012
Feb 08

Background: By default the taxonomy_term view is available to generate views of the terms in given taxonomies. This view may be extended just like any other view to provide a lot more information, however with this customization you may find yourself wanting a different view for different taxonomies.  In our case we have a taxonomy of electronic journals and resources that needs to look vastly different from the historical collections where pictures and such are available.

TVI let's you pick your taxonomy term view from the taxonomy page


Our solution: Taxonomy Views Integrator allows you to choose which view to associate with which taxonomy through a very handy and intuitive drop down menu.  Since there are already too many redirects and such on our site in my opinion this is the way to go.  We cloned our default taxonomy term view and added some new filters… voila!  Then just go to /admin/content/taxonomy and in each vocabulary you may choose which view to use… taxonomy and views… integrated.. better than chocolate caramel lobster salad…

For the videophiles here’s your two minute walkthrough…

NB: There are several tools out there to accomplish this task:

Views Term Path Override: overrides the term path – more URL’s getting flung about, however it’s certainly viable

Taxonomy Redirect: Likewise, probably works, but just doesn’t seem quite as elegant or obvious – not certain which of our admins would remember to

probably a few other ways of doing this… thanks to deeporange1 and awebb for this handy mod

Jan 25 2012
Jan 25

It’s been a while since we looked at Apachesolr Drupal integration.  In large part that is because it “just works.”

It's solr, in a view, with exposed filters, facets, and it brews tea!

With the recent release of new code on Apachesolr Views (Big ups to dstuart, Ravi.J and ygerasimov for the recent contributions… everything seems to be aces) it’s time to revisit the subject.

If you have struggled with theming the search-result.tpl.php file and really don’t want to learn any more about getting great faceted search results you are totlally in luck!  Note to all: we’re using views 3.x-dev, apachesolr 3.x-dev, and apachesolr_views 3.x-dev.

For those of you who are video inclined here’s a ~4 minute screencast

For the rest of you Robert Douglass called it over two years ago in his “views 3 + apachesolr + acquia drupal = the future of search” post and for the most part that’s the deal – if you want to see more screen shots go there.

We’re also using ApacheSolr Custom Fields and the Batch Indexing module (thanks anarchivist)  (as mentioned previously).  Note that at this time the custom field module requires this fix to run… but still a handy module.

Learn to not code with the help of nice mods!

Custom Fields is well worth the minor effort in that it is another piece of the no-coding puzzle.  We also enjoyed having views php (a bit of coding is ok – we used it to set up displays per content type in the view)

Also using better exposed filters again to make the UI for the exposed filter better… gotta love naming conventions!

In any case the working view took about 10-15 minutes to produce, with ~5 minutes spent making tea.

Attached below is our working stack in a zip file

if anyone wants to download the entire package that we’re using go ahead, there are a few known issues including taxonomy facets that still need to be patched in this release, however for many use cases it is good to go
 Solr Stack – Views + Apachesolr + Apachesolr Views + Batch Reindex + Custom Fields

Jan 25 2012
Jan 25

A glossary index is a helpful tool for our patrons to find the journals that they are looking for – building your first glossary can be a struggle so here’s a 2 minute video to walk you through the basics

Working in the arguments region in views

Once we had the block built we attached it to our view of titles using contexts.  Another way that would have been acceptable would have been Views Attach.  I wanted to use the attached views, however I wasn’t entirely certain about all possible use cases, so we just went with  a block and joined everything up using contexts.

A path, node type, and taxonomy based context

And yes, we could have added “views” conditions as well, although it is already pretty much overkilled…  in any case it’s another beautiful day with contexts & views

Jan 24 2012
Jan 24

Exposing filters in a view is a great way to add interactivity to lists. Out of the box Drupal Views lets you use CCK select lists as an end user visible filter.  The downside is that the select list is a clunky user interface.  To select multiple options you have to hold down the control button while mousing around – not so bad with a short list, but rapidly unmanageable with a longer list.

To solve this user experience conundrum mikeker provided the new and improved exposed filters… aptly called “better exposed filters“  – one thing I like about drupal is that the naming conventions tend to be fairly obvious.

Here’s a brief ~2 minute walkthrough of setting it up

Before Better Exposed Filters

After Better Exposed Filters

Note: you do of course have to expose the filter in views before being able to use the “better” exposed filter…

The tools are available in a new block within your view

Initially after turning the module on I expected to see the new options available from within the filter section of the view, however the module creates a new menu region within views… afterwards style the output as you see fit with css – such that happiness may reign.  any questions or comments welcome

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web