Hi, for a newbie in php, how could i display the event date in the event block....anybody with this?

thanks,

Comments

seaneffel’s picture

I also would like see the event block display the event date. Right now the default display is days remaining. How can we change this? Take a look at the event block on my site:

http://www.squarefour.org

There is also some brief discussion here, but has gone no where for weeks:

http://drupal.org/node/30899

seaneffel’s picture

One of the comments there suggested the code change should be in events.theme, a file included in the events module bundle. I took some blind stabs, not speaking php myself, and I think I found our answer.

I changed this line in events.theme from this:

/**
 * Format an individual upcoming event block item
 *
 * @param node
 *   The node to render as an upcoming event
 */
function theme_event_upcoming_item($node) {
  return l($node->title, "node/$node->nid", array('title' => $node->title)). '<span class="event-nodetype">('. $node->typename .')</span>       <span class="event-timeleft">('. $node->timeleft .')</span>';
}

To this. The change is in the last bit there where it says "event-timeleft":

/**
 * Format an individual upcoming event block item
 *
 * @param node
 *   The node to render as an upcoming event
 */
function theme_event_upcoming_item($node) {
  return l($node->title, "node/$node->nid", array('title' => $node->title)). '<span class="event-nodetype">('. $node->typename .')</span> <span class="event-timeleft">'. gmdate('m/d/Y', $node->event_start) .'</span>';
}

It makes the block display the event start date instead of the days remaining. Its a barbaric fix, it doesn't consider events with date ranges, but its a step in the right direction. If it works for you then let me know so I can pat myself on the back. Never edited php on my own before.