Hi,
I've been slowly banging my head on this for the past few days.
I want to theme my forum, and have gotten a bit stuck on how a thread list is displayed (i.e. a forum node and its associated comments). Most of the documentation I have found has been on how to theme the list of forums, or the list of forum topics, but not a list of forum threads.
A forum is made up of three type of lists that could be themed, e.g.
-Forum A <item in a forum list>
-Forum B <item in a forum list>
-Forum C <item in a forum list>
-Topic A <item in a topic list>
-Topic B <item in a topic list>
-Topic C <item in a topic list>
-Main Node <item in a thread list>
-Comment 1 <item in a thread list>
-Comment 2 <item in a thread list>
I've managed to theme the forum list and the topic list, but the thread list is leaving me a little worse for the wear.
I'm using FlatForum to theme each individual node or comment in a thread, but I want to be able to wrap the whole thread with a header and footer similar to what you see at http://www.terminus1525.ca/node/35825 Essentially at the top and bottom of each thread I want a "Add a new comment >>" link and a pager.
Now I've managed to do this at the top of the thread by creating a custom page-forum.tpl.php file where I do the following:
if ($node->type == 'forum') {
if (user_access('post comments')) {
$postlink = l(t('Add a comment >>>'), "comment/reply/$node->nid");
}
.
.
.
$forum_pager_header = array(
array('data' => $postlink, 'field' => NULL, 'colspan' => '2'),
array('data' => theme('pager', NULL, $forum_per_page, 0), 'field' => NULL, 'colspan' => '2')
);
print('<div class = "forum_pager">' . theme('table', $forum_pager_header, NULL) . '</div>');
}
php print $content; Essentially I print the header I want before I print out $content. This works fine for the header.
The problem for the footer is that $content already includes its own pager in it and I have not quite worked out how $content is generated for a forum thread or how to modify it.
Via the flatforum module, my node-forum.tpl.php themes an individual node or comment in a thread, but not the thread list. So I need to know what happens between my page-forum.tpl.php and my node-forum.tpl.php to understand how the thread is built. I have a hunch that it is through the normal node/comment building mechanisms, but is there a way I can override this?
Patrick
Comments
Clarification and little more code
Just to clarify the above, I want to style the list of posts in a forum thread... or more accurately wrap the list of posts in a forum thread with a header and a footer.
I managed to do something like this for the list of topics in a forum by overriding theme_forum_topic_list in my template.php
So the forum becomes something like:
Unfortunately, forum does not provide anything like this for inside a thread, there is no theme_forum_thread_list to override! You can just override the forum list or the topic list, but not the lists of posts in the thread. Below is the code I used in my template.php for the forum topic list, in case anyone is interested:
This worked for me in 5.5.
This worked for me in 5.5. Thanks for the code.
patrick hi, i also would
patrick hi,
i also would like to put page on top of everything on forum pages as it's done on http://www.terminus1525.ca/node/35825
but your code did not work for me. i think page-forum.tpl.php overrides node-forum.tpl.php and as i use flatforum module i have bunch of stuff in node-forum.tpl.php.
That was just a code snipper
Oops sorry,
that was just one part of what I've done to make it work more like the terminus1525 site, when I get a moment I'll look through the other parts of my code to see what else I did to get that list and try and post it.
cheers,
Patrick
I'm still trying to figure this one out
I've run into the same problem you were having, setting the theme of the thread list. All I really need ot do is set a Div or two at the page level (in my page-forum.tpl.php file), but I cannot figure out how to detect if the thread nodes are part of the forum in my code. I've tried adding if ($node->type == 'forum') to my page template but it doesn't work. I was hoping you could provide some suggestions.
Thanks,
Erick