Wednesday, June 28, 2017 05:02 pm EDT
Bri's picture

Drupal 7 Views Contextual Filters to Create a Summary of Taxonomy Terms

Here I want to setup a page with a few views. I want to create a page of node teasers of some sort, perhaps with some exposed filters, but I also want a block that shows a summary of my nodes. I want the block to show how many nodes are in a particular taxonomy. This is nice to do with a taxonomy of States or "types" and acts as a "view nodes by type" action. This can be done with a regular text field as well, but if you are using a taxonomy it is a little trickier. Here are some basic instructions to create a page that looks like the following:

Bri's picture

Git command cheat sheet

The majority of this list came from but I have added in some tidbits that I have found in other places as well.


git config -e [--global]
edit the .git/config [or ~/.gitconfig] file in your $EDITOR

git config --global 'John Doe'
git config --global
sets your name and email for commit messages

git config branch.autosetupmerge true
tells git-branch and git-checkout to setup new branches so that git-pull(1)

Bri's picture

Change the submitted variable in drupal 7

Go to: /admin/config/regional/date-time/formats/add
Create desired time format, i.e. l, d/m/Y or see for available options.
Add format.
Go to: /admin/config/regional/date-time
Set medium data type into the desired one.

Bri's picture

Theming the Contact Form in Drupal 7 (contact_site_form)

Theming the contact form in Drupal 7 is almost the same as most people did it in Drupal 6, but the one change through me for a loop for quite awhile.

Using Drupal 6, most people would add some code to their template.php file and create something like the following:


function myTheme_theme() {
  return array(
	'contact_mail_page' => array(
					'arguments' => array('form' => NULL),
					'template' => 'contact-form',
function myTheme_preprocess_contact_mail_page(&$vars)
	$vars['name'] = drupal_render($vars['form']['name']);	
Bri's picture

An Example of Using db_query in Drupal 7

If you are writing your own modules, there is a good chance you have used db_query quite a bit in the past. The database layer has been overhauled in Drupal 7, and as a result, the way you get query results has changed slightly. Here is an example to how you how it's used.

// Notice the place holders are now done using the same syntax as PDOs (:uid)
// Placeholders also don't need to be quoted anymore.
$uid = 1;
$result = db_query('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid));
Syndicate content