Closed (fixed)
Project:
Event
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2008 at 19:25 UTC
Updated:
4 Apr 2009 at 00:06 UTC
hi i'm trying to display the start date in de upcoming list view instead of the 'time left'.
i tried to work with a hook in
function framework_event_upcoming_item($node, $types = array()) {
$output = l($node->title, "node/$node->nid", array('attributes' => array('title' => $node->title)));
if (count($types) > 1) {
$output .= '<span class="event-nodetype">('. $node->event['node_type'] .')</span>';
}
$output .= '<span class="event-timeleft">('. $node->event['timeleft'] .')</span>';
return $output;
}
but when i replace 'timeleft' with 'start' or 'start_utc' nothing gets displayed.
also tried to create new view but the i don't get any field with the start date.
any suggestions on any of these ways of solving the problem? thanks!
Comments
Comment #1
killes@www.drop.org commentedFOr performance reasons the upcoming events block does not fetch whole nodes, but only sceleton nodes.
If you want full nodes, you need to implekment hook_event_edit_upcoming and do a node_load in there.
Comment #2
stijn vanhandsaeme commentedi'm sorry but i don't know where to start with what you say. don't have to explain everything i think. just a hint of how to start. thank you very much for your help!
Comment #3
stijn vanhandsaeme commentedcan anyone help me with this? thank you.
Comment #4
frank ralf commentedWill have a look at it when I find the time. Always wanted the same changes ;-)
(Would be nice to have that as a configurable option in the module.)
For some documentation on implementing
hook_event_edit_upcomingyou might have a look at http://drupal.kollm.org/doxygen/_contrib/drupal-contrib-phpdoc/group__ev... .Frank
Comment #5
frank ralf commentedHello,
In addition to your modification of the theming function you have to implement
hook_event_edit_upcomingin your module like so (as written in #1):That loads the full node object with all the attributes available.
HTH
Frank
Comment #6
frank ralf commentedComment #7
killes@www.drop.org commentedI think that's enough info, thanks Frank!
Comment #8
frank ralf commentedAn even simpler solution is using
$node->event_startinstead of$node->event['timeleft']infunction theme_event_upcoming_item()(http://www.drupalcenter.de/node/10643)
Frank
Comment #9
stijn vanhandsaeme commentedok thank you very much.
this code works when applid in event.theme
but this code does not work in template.php (changes don't apply although i cleared cache)
and ireally don't see why it would not work. i'd rather not hack the module files.
Comment #10
stijn vanhandsaeme commentedsorry tried to change status to 'need more info'
Comment #11
frank ralf commentedThe following code does work with my installation when put in template.php. Be sure to name the function according to your theme.
You might also have a look at Can't seem to theme the events module output http://drupal.org/node/306497.
And if you are working with a subtheme of Garland you should read Garland overrides template with theme function http://drupal.org/node/295895 (might be a theme related problem).
HTH
Frank
PS:
Using
<?php ... ?>instead of<code>improves readability of your code snippets ;-)Comment #12
stijn vanhandsaeme commentedi upgraded my theme (framework-garland based?) and rebuilt the layout. now it works (code i gave above works too), though i don't know what gave the error.
very much thanks everyone!
Comment #14
mokko commentedthis is good I need to look at it later.
Comment #15
cafuego commentedSee also the patch at http://drupal.org/node/34271