Project:Tribune
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

the module works great, but a bit confusing. I'd need to show also the date (day/month) in front of the post time

Comments

#1

Version:6.x-1.5» 6.x-1.6
Status:active» postponed (maintainer needs more info)

Okay so I've changed most of the code to use theme functions now, so you could just implement in your theme a function like this for example :

<?php
function garland_post_time($post) {
   
$contents  = "<span class='tribune-first-clock' title='id=". $post['id'] ."'>";
   
$contents .= date('H:i d/m/Y', tribune_date_to_timestamp(tribune_date_to_localdate($post['post_time'])));
   
$contents .= "</span>\n";
    return
$contents;
}
?>

This displays post time as "13:07 17/11/2008". Of course, post matching with clocks will not work as well, though, unless you include $post['clock'] somewhere.

Please tell me if it worked :)

#2

sorry, I feel so stupid, but I don't know where tu put

<?php
function garland_post_time($post) {
   
$contents  = "<span class='tribune-first-clock' title='id=". $post['id'] ."'>";
   
$contents .= date('H:i d/m/Y', tribune_date_to_timestamp(tribune_date_to_localdate($post['post_time'])));
   
$contents .= "</span>\n";
    return
$contents;
}
?>

and this

$post['clock']

#3

What theme are you using?

There should be a file called template.php in your theme's directory (if it doesn't exist, I think you should just create it), append this code to it:

<?php
function phptemplate_post_time($post) {
   
$timestamp = tribune_date_to_timestamp(tribune_date_to_localdate($post['post_time']));

   
$contents  = "<span class='tribune-first-clock' title='id=". $post['id'] ."'>";
   
$contents .= date('H:i d/m/Y', $timestamp);
   
$contents .= "</span>\n";

    return
$contents;
}
?>

... there are howtos and documentation about overriding theme functions in Drupal.org handbooks, but I can't look for them now.

This template.php file should be located in <site root>/themes/<theme name>/template.php, I think

#4

I appended the function in /themes/deco/template.php
but I got following error
Fatal error: Call to undefined function get_last_posts() in /sites/all/modules/tribune/tribune.page.inc on line 62

any idea? thanks a lot for your help

#5

Hmm, are you sure you haven't touched anything other than your theme's template.php file? Because in no way could this cause this problem... maybe you should try to download the latest version and replace all the files in your modules/tribune folder.

#6

I double checked also with tribune 1.8, now I don't get any error, but nothing changes with the time printed in front of each message (no date printing in front of time)

#7

I solved the problem (on tribune 1.8) hacking the tribune.mudule file at line #816

function theme_post_time($post) {
$timestamp = tribune_date_to_timestamp(tribune_date_to_localdate($post['post_time'])); //gio inserito riga - new line added
$contents = "";
// $contents .= $post['clock']; // gio eliminato riga - deleted line
$contents .= date('jM H:i', $timestamp); // gio inserito riga - new line added
$contents .= "\n";

return $contents;
}

#8

Status:postponed (maintainer needs more info)» fixed

Well, I suppose it's fine then... doing it with a theme override would have prevented problems when updating the module, though

#9

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

#10

Version:6.x-1.6» 6.x-2.x-dev
Status:closed (fixed)» active

how do I add year/month/day to hour/minute/second related to the post-time in tribune?
the previous hack is not working anymore with 2.x-dev version.
any help is apprecciated