Closed (duplicate)
Project:
Advanced Forum
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Mar 2009 at 00:09 UTC
Updated:
16 Jun 2009 at 04:58 UTC
1) What is the best way to theme a new content type e.g. "My Forum Topic" as a Forum post. Comments are all enabled fine, but the node that the comments attach to needs themeing.
2) Is there an easy way to theme the output of a view as a list of forum topics based on new content type? I don't need it to be integrated in the overall forums lists/taxonomy/containers at all, simply for the view to show the list of posts in a similar way to the List of Forum posts in a Forum (not a container). With a simple table view I can get all the fields I need but it now needs formatting: Topic - Replies- Views - Created by- on - Last reply by - on
Views override?
Thanks, Stephen
Comments
Comment #1
michelle#1: I'm not sure I understand. You want nodes outside of the forum to be themed like forum nodes? You could probably use
hook_treat_as_forum_post_alter($decision, $hook, $variables)for that. I haven't tried it but it should, in theory, work. If that's not what you mean, please explain more.#2: I really don't know... I've never tried to to theme a view that way. This is a question better asked in the forums as it's into custom coding and beyond the realm of module support.
Michelle
Comment #2
scedwar commentedMichelle - thanks. V. useful.
#1 - I have created a new cck node type, a sort of custom forum node if you like. The comments are all themed as forum posts, as are all the comments on our site. However, the node itself is a dull and plain page. I want all nodes of my new node type to be displayed as a forum post with the author pane on the left, and the themed reply buttons etc. This is not an issue about containers or forums or breadcrumbs, simply the styling of the node itself.
#2 - Thanks. Maybe the question should be this. Given a custom query I generate (through a view or otherwise), is there a way to generate a listing of nodes themed in such a way to look like a forum, as at this URL on your site:
http://socnet.shellmultimedia.com/forum/7
All of the fields you show for nodes and comments relevant to that forum can be displayed in a view, just not formatted in the same way. As an analogy, imagine themeing the Drupal tracker at http://drupal.org/tracker to look like your forum at: http://socnet.shellmultimedia.com/forum/7
Keep up the great work on Advanced Forum. It is clearly much appreciated by many.
Comment #3
michelle#1: Ok, then I did understand correctly so you can try it with that hook I mentioned. $variables has the node type on the node hook. It needs to return the node ID if you want it to be themed.
#2: I understood the question but I don't know the answer. I've never tried to theme a view to make it look like the forum list. I believe a table view uses theme_table so you would want to put it together with a list view. Beyond that, I don't know any specifics. You'll need to play around with it or ask in the forums to try and catch someone with more experience with theming views. This is really a views support question, not an AF one.
Michelle
Comment #4
scedwar commentedThanks Michelle. We'll have a look at this and report back. As an aside, this will take us 99% of the way to implementing a simple forum per og without using og_forum, but I'll fire up another issue to report when we've got it all sussed.
Comment #5
scedwar commented#1 Your example at http://drupal.org/node/392090 appears to work fine. Have commented accordingly. Thanks!
#2 We'll look at this and experiment. I'm thinking a view override calling advanced forum themeing templates, or functions, may be the answer. The same solution should help us with a related issue, to generate a view of recent posts appropriately themed: http://drupal.org/node/362605
Comment #6
michelleGreat. I'll take the note/comment off the book page then. If you come up with anything that you think will make this more useful, let me know. It's too late for 1.x but I'll be starting in on 6.x-2.x in a couple months and that's wide open for features.
Michelle
Comment #7
scedwar commented#1 - I would suggest, adding a list of checkboxes in the Advanced Forum settings that lets you select the node types that are formatted to look like forum posts. It is a logical development of the option to theme all comments as forum posts.
#2 - will investigate and get back to this thread.
Comment #8
michelle#1 sounds reasonable. I could have two sets... "Theme these node types" and "Theme comments on these node types". Default it to theming anything set to go in the forum and allow adjustments from there. Wouldn't be hard to do, either.
Michelle
Comment #9
dries arnoldsMichelle, your last comment describes my wishes perfectly. That would be a great help in building a community with powerful forum integration.
Comment #10
scedwar commented#1 - Michelle that would be ideal. An excellent addition to the module.
Comment #11
michelleMoving this over to the 2.x queue so I don't forget.
Michelle
Comment #12
farald commentedsubscribing, this feature would be just great! :)
Comment #13
michelleComment #14
tsi commentedThis feature will be great for styling my Organic groups posts as a forum discussion.
I believe that http://drupal.org/node/392090 is just what I need but building an extra module is a bit over my head.
Would love to know how this can be done without building the module.
Comment #15
scedwar commentedIt isn't that complicated. You can let Forum topics be posted into groups. Or, you can use CCK to create a new content type and theme that as a Forum Post (e.g. a MyOGForum type which you theme using the snippet above).
Posting forum topics into an og is one thing. Having a completely self contained forum per og is another issue and best discussed in one of the other threads covering that rather than making this issue drift off topic. Search on my username and you'll find discussions on this.
Comment #16
scedwar commentedSorry, just re-read your post. You need to create a module to theme the post as at present. However, it can be tiny and essentially hold just the code in the snippet. Have a look at the handbook to see how to write your first module, it really is easy when you know how, and a general utility module is vital for making these kind of customisations. http://drupal.org/node/82920
Comment #17
michelleMerging with #492794: Improve function for determining what gets the style applied
Michelle