I have a lot of work to do on node-forum.tpl.php and comment.tpl.php in an attempt to get a nice fresh look to my forums.
I have a few specific questions, but don't want to swamp everyone so will just begin with what is hopefully quite a simple one:
on the forum listing page (where you actually have the threads listed out), both the Created and Last Reply columns have the date in "Time Ago" format. How can I alter this to be an actual date? I presume I would need to go into the forum.module file, is that correct?
Thanks in advance
Neil
Hi Neil,
I haven't themed forums in this way but here's the general approach:
You want to *look* in forum.module (and possibly other files such as include/*.inc files-- core isn't entirely modular (yet) to try to find the function that outputs the time. It _should_ be named function theme_something_something. (Where it is actually called to produce output it will be in the form theme('something_something') -- this is how Drupal allows you to override theme functions rather than modify core.
You don't modify forum.module, you will want to copy that function, paste it in a template.php file for your theme, and rename it mythemename_ or phptemplate_something_something, and modify it here.
I'm not saying it won't get more complicated than this ( for instance, you don't want to retheme something like theme_item_list because that will change the display all over your web site, so you need to look for a more specific theme_ function that calls theme_item_list ) but that's the Drupal way there.
benjamin, Agaric Design Collective, http://AgaricDesign.com/
On Nov 5, 2007 7:07 PM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
I have a lot of work to do on node-forum.tpl.php and comment.tpl.php in an attempt to get a nice fresh look to my forums.
I have a few specific questions, but don't want to swamp everyone so will just begin with what is hopefully quite a simple one:
on the forum listing page (where you actually have the threads listed out), both the Created and Last Reply columns have the date in "Time Ago" format. How can I alter this to be an actual date? I presume I would need to go into the forum.module file, is that correct?
Thanks in advance
Neil
[ Drupal support list | http://lists.drupal.org/ ]
I have found this in the forum.module:
---------------- /** * Format the topic listing. * * @ingroup themeable */ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) { global $forum_topic_list_header; $rows = array(); if ($topics) {
foreach ($topics as $topic) { // folder is new if topic is new or there are new comments since last visit if ($topic->tid != $tid) { $rows[] = array( array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'), array('data' => check_plain($topic->title), 'class' => 'title'), array('data' => l(t('This topic has been moved'), "forum/$topic->tid"), 'colspan' => '3') ); } else { $rows[] = array( array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'), array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'), array('data' => $topic->num_comments . ($topic->new_replies ? '<br />'. l(format_plural($topic->new_replies, '1 new', '@count new'), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'), array('data' => _forum_format($topic), 'class' => 'created'), array('data' => _forum_format(isset($topic->last_reply) ? $topic->last_reply : NULL), 'class' => 'last-reply') ); } } }
$output = theme('table', $forum_topic_list_header, $rows); $output .= theme('pager', NULL, $forum_per_page, 0);
return $output; } ----------------
But I can't find the forum_topic_list theme anywhere in my drupal files.
----- Original Message ----- From: "Benjamin Melançon" pwgdarchive@gmail.com To: support@drupal.org Sent: Tuesday, November 06, 2007 2:15 PM Subject: Re: [support] few forum customizations.
Hi Neil,
I haven't themed forums in this way but here's the general approach:
You want to *look* in forum.module (and possibly other files such as include/*.inc files-- core isn't entirely modular (yet) to try to find the function that outputs the time. It _should_ be named function theme_something_something. (Where it is actually called to produce output it will be in the form theme('something_something') -- this is how Drupal allows you to override theme functions rather than modify core.
You don't modify forum.module, you will want to copy that function, paste it in a template.php file for your theme, and rename it mythemename_ or phptemplate_something_something, and modify it here.
I'm not saying it won't get more complicated than this ( for instance, you don't want to retheme something like theme_item_list because that will change the display all over your web site, so you need to look for a more specific theme_ function that calls theme_item_list ) but that's the Drupal way there.
benjamin, Agaric Design Collective, http://AgaricDesign.com/
On Nov 5, 2007 7:07 PM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
I have a lot of work to do on node-forum.tpl.php and comment.tpl.php in an attempt to get a nice fresh look to my forums.
I have a few specific questions, but don't want to swamp everyone so will just begin with what is hopefully quite a simple one:
on the forum listing page (where you actually have the threads listed out), both the Created and Last Reply columns have the date in "Time Ago" format. How can I alter this to be an actual date? I presume I would need to go into the forum.module file, is that correct?
Thanks in advance
Neil
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
function theme_forum_topic_list *is* the theme you're looking for.
Copy it into template.php and name it phptemplate_forum_topic_list and you'll be able to override it.
I imagine the part you want to change is here: array('data' => _forum_format(isset($topic->last_reply) ?
benjamin, Agaric Design Collective, http://AgaricDesign.com/
On Nov 6, 2007 9:44 AM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
I have found this in the forum.module:
/**
- Format the topic listing.
- @ingroup themeable
*/ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) { global $forum_topic_list_header; $rows = array(); if ($topics) {
foreach ($topics as $topic) { // folder is new if topic is new or there are new comments since lastvisit if ($topic->tid != $tid) { $rows[] = array( array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'), array('data' => check_plain($topic->title), 'class' => 'title'), array('data' => l(t('This topic has been moved'), "forum/$topic->tid"), 'colspan' => '3') ); } else { $rows[] = array( array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'), array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'), array('data' => $topic->num_comments . ($topic->new_replies ? '<br />'. l(format_plural($topic->new_replies, '1 new', '@count new'), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'), array('data' => _forum_format($topic), 'class' => 'created'), array('data' => _forum_format(isset($topic->last_reply) ? $topic->last_reply : NULL), 'class' => 'last-reply') ); } } }
$output = theme('table', $forum_topic_list_header, $rows); $output .= theme('pager', NULL, $forum_per_page, 0);
return $output; }
But I can't find the forum_topic_list theme anywhere in my drupal files.
----- Original Message ----- From: "Benjamin Melançon" pwgdarchive@gmail.com To: support@drupal.org Sent: Tuesday, November 06, 2007 2:15 PM Subject: Re: [support] few forum customizations.
Hi Neil,
I haven't themed forums in this way but here's the general approach:
You want to *look* in forum.module (and possibly other files such as include/*.inc files-- core isn't entirely modular (yet) to try to find the function that outputs the time. It _should_ be named function theme_something_something. (Where it is actually called to produce output it will be in the form theme('something_something') -- this is how Drupal allows you to override theme functions rather than modify core.
You don't modify forum.module, you will want to copy that function, paste it in a template.php file for your theme, and rename it mythemename_ or phptemplate_something_something, and modify it here.
I'm not saying it won't get more complicated than this ( for instance, you don't want to retheme something like theme_item_list because that will change the display all over your web site, so you need to look for a more specific theme_ function that calls theme_item_list ) but that's the Drupal way there.
benjamin, Agaric Design Collective, http://AgaricDesign.com/
On Nov 5, 2007 7:07 PM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
I have a lot of work to do on node-forum.tpl.php and comment.tpl.php in an attempt to get a nice fresh look to my forums.
I have a few specific questions, but don't want to swamp everyone so will just begin with what is hopefully quite a simple one:
on the forum listing page (where you actually have the threads listed out), both the Created and Last Reply columns have the date in "Time Ago" format. How can I alter this to be an actual date? I presume I would need to go into the forum.module file, is that correct?
Thanks in advance
Neil
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
--
[ Drupal support list | http://lists.drupal.org/ ]