I'm building a site for a NYC public school, and the client desperately wants her Event list to show the date and time of the event rather than simply "(6 Days)". There must be a way to do this, right? I thought the Views module might offer something, but it doesn't look like it.

Am I missing something obvious?

Here's the site I'm building (with the calendar list on the right):


The client wants a list that looks more like the one on the left side of this site:


Any suggestions?

Alan Brooks


pbarnett’s picture


You can certainly do this with Views; here's one that will list upcoming events; you can import it, enable the block that it provides and then tweak the formatting, fields etc. to your liking.

 $view = new stdClass();
  $view->name = 'upcoming_events';
  $view->description = '';
  $view->access = array (
  $view->view_args_php = '';
  $view->page = FALSE;
  $view->page_title = '';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'node';
  $view->url = '';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->block = TRUE;
  $view->block_title = 'Upcoming Events';
  $view->block_header = '';
  $view->block_header_format = '1';
  $view->block_footer = '';
  $view->block_footer_format = '1';
  $view->block_empty = '';
  $view->block_empty_format = '1';
  $view->block_type = 'list';
  $view->nodes_per_block = '10';
  $view->block_more = FALSE;
  $view->block_use_page_header = FALSE;
  $view->block_use_page_footer = FALSE;
  $view->block_use_page_empty = FALSE;
  $view->sort = array (
  $view->argument = array (
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    array (
      'tablename' => 'event',
      'field' => 'event_start',
      'label' => '',
      'handler' => 'views_handler_field_date_small',
      'defaultsort' => 'ASC',
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'event',
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    array (
      'tablename' => 'event',
      'field' => 'event_start',
      'operator' => '>',
      'options' => '',
      'value' => 'now',
  $view->exposed_filter = array (
  $view->requires = array(node, event);
  $views[$view->name] = $view;


alanbrooks’s picture

Thank you Pete. That works like a bought one. This saved me a lot of pain and suffering because the client's on a tight schedule and I would never have been able to figure out how to do that in the time I've got.

You're a life-saver!

Alan Brooks

pbarnett’s picture


Glad to be able to help; Views is an incredibly useful tool, but it does come with a bit of a learning curve :-)

The site looks excellent!

Feel free to contact me if you need any further help...


tenasi’s picture

Hello and thank you for sharing this code to create a list of events. I have a website www.artofunion.com
and want to do a similar list of events displaying date, type and title (with link) to the page.
I found a page similar to what I am looking for

will your code work for that?

Also (and I know this is a newbe ?? but where do I plug that code into?) I have been running a non profit community site for some years that was first basic html, and last year a ´friend´convinced me to get on drupal, and now he has gone corporate and abandoned me.

So if you can guide me through...I am confident I can upload your code

thank you again

ps one more thing, is it possible there is a glitch in the list of events module, b/c it only works when I have it set to the show up on every page except option and not when it is set on the ¨show only on listed pages¨ ???

pbarnett’s picture

Hi from the UK!

The code isn't stuff that I've written, it was exported from a view that I made using the Views UI (user interface).

There are some excellent tutorials on the Views module, but your requirements are quite simple, so I'll talk you through it.

This is for Drupal 5.x, but the procedure is very similar for 4.7.x, navigation to the Views and Categories is just slightly different.

Before you start, make sure that you have downloaded, installed, and enabled the Views module including the Views UI.

Check that Drupal's built-in Taxonomy module is enabled.

You will need to set up a vocabulary of types for your events using the Taxonomy module; let's do that first.

Go to Administer > Content Management > Categories and click on 'Add vocabulary'.

Enter 'Event Type' for the vocabulary name; you can leave the Description and Help Text fields blank for now; you can always go back and add these later.

Click on 'Event' for the node type and 'Single' and 'Required' for the heirarchy; this means each new event MUST have a category.

Click 'Submit', and tou should see your new 'Event Type' vocabulary in the list of categories. Now lets add the actual terms by clicking on 'add terms' for the 'Event Type' vocabulary.

Leave the Parent field at its default setting of add the term name (the name is up to you, I'll just use 'Term1', 'Term2' etc. You can add a description for the term if you want to) and click 'Submit'.

You'll see a message saying 'Created new term Term1.'. Continue adding term names until you have all the terms you need; you can always add more later.

Now, when you go to create a new event, you'll see a new drop-down titled 'Event Type' where you can select one of the types you created in the 'Event Type' vocabulary. Create some events of each type.

OK; on to creating the view...

Go to Administer > Site building > Views and click on 'Add'.

In the 'Basic information' section, enter 'eventlist' for the name, and 'List of events filtered by type' for the description.

We want a page view, so in the 'Page' section, select 'Provide page view', enter 'eventlist' for the URL (this doesn't have to be the same as the view name; the page will appear at http://www.yoursite.com/eventlist in this case) 'List view' for the View type (we only want a list of events, not the full nodes) and an optional title; leave 'use pager' checked and 'nodes per page' at 10 for now.

In the 'Menu' section, click on 'Provide menu', set the weight to 0 and the menu title to 'Event List'.

In the 'Fields' section under 'Add field', select 'Event: Start Date' and click on 'Add field'. The field should appear above the 'Add field' dropdown. Select 'Yes' in the 'Sortable' dropdown, as we will be sorting on this field, with the sort type set to 'Ascending'.

Repeat this with 'Taxonomy: Terms for Event type'; when the field appears select 'Without links' under 'Option'.

Finally, select 'Node: Title', Handler 'as normal', Option 'As link'.

In the 'Filters' section, select 'Node: Published', Operator 'Equals', Value 'Yes'. This is recommended for all views.
Still in the 'Filters' section, select 'Taxonomy: Terms for Event'. Click on the 'Expose' button.
Still in the 'Filters' section, add 'Event: Start Date', Operator 'Is Greater Than', value 'now'. This will ensure that only future events are shown.

Go down to the 'Exposed Filters' section, and add 'Event Type' as a label.

Under 'Sort Criteria', select 'Event: Start Date', click on 'Add criteria', and set the order to 'Ascending'.

Save your view; you'll see a message confirming 'View successfully added.' and the new view listed under 'Existing Views'.
You should also see 'Event List' in the admin Navigation menu; clicking on it will take you to your view, and allow you to use the exposed filter to select which event type or types are listed.

The default presentation of the view could be improved enormously; I added the following lines to the end of my theme's style.css file to get the fields inline with some space between them :-

.view-content-eventlist .view-data-event-event-start{
  display: inline;
.view-content-eventlist .view-data-term-node-3-name {
  display: inline;
  padding-left: 5em;
.view-content-eventlist .view-data-node-title {
  display: inline;
  padding-left: 5em;

For more details about theming your view, I'll refer you to the Views theming tutorial.

Hope this helped.


jeffreyblove’s picture

Thanks Pete. Great contrib! Just one more thing.
I'd like to keep the default countdown format, but just exclude a certain taxonomy tag (actually, I could exclude multi-day events and achieve the same result, but a taxonomy example is much more useful). Your example and what I've seen in the views UI (5.7) allow only dates.

I know I could override theme_event_upcoming_item, but would rather just have my view look the way I want it. I've looked over the theming tutorial in a cursory way, but 'fixing' the PHP looks easier so far ...

Any thoughts?

pbarnett’s picture

Hi Jeffrey!

I've looked into this, and the Views UI will let you add a filter on taxonomy terms.

Overriding theme_event_upcoming_item would give you a lot more scope in terms of presentation, though.

the code is just

function theme_event_upcoming_item($node) {
  $output = l($node->title, "node/$node->nid", array('title' => $node->title));
  if ((count(event_get_types('all')) + count(event_get_types('solo'))) > 1) {
    $output .= '<span class="event-nodetype">'. t("($node->typename)") .'</span>';
  $output .= '<span class="event-timeleft">('. $node->timeleft .')</span>';
  return $output;

so there's plenty of scope for tarting it up :-)

You could even do the exclusion in your phptemplate_event_upcoming_item by adding the line

if (taxonomy_node_get_terms($node->nid, 'yourterm')) return '';

though I haven't tried this...

What did you want the view to look like?


Mitch Hunter’s picture


I am completely new and lost in doing changes. I am using Joomla 1.5 and have decided to install Event List. This is a good tool but I am missing some key components :

- Event Id (not there yet),
- Venue Post Code (exists),
- Small picture,
- Some user fields

I am trying to get this included into Event List but can not find my way. Also, I need to create some new views (eg. one showing the archived events or another one with less details). My website is 100% operational but lacks this key stuff

Is there someone that can help me out achieving/addressing this challenge?


pbarnett’s picture

Lost in doing changes is right - this is not the Joomla site, this is the Drupal support forum! :-)


Mitch Hunter’s picture

You are right but I am a little bit lost and the Event List forum is dead/down so, can't get support. Do you know someone that would know?