By matthew on
Hi-
I am working on a custom PHPTemplate theme for a new site that I'm building. It's all came around relatively smoothly, but the forum module is kicking my butt. How can I theme it??? I don't like the default look & feel of the forums, as it does not fit with my theme at all, but I've been totally unsuccessful in all attempts to change how they work.
ANY tips on customizing a forum as much as it's been done here (http://www.terminus1525.ca/forum, or even the Drupal forums here!) would be extremely welcome.
I spent quite a bit of time in the search engine here only to come up empty handed. Please help!
Regards,
Matthew
Comments
I'm trying to do the same..
Hi Mathew,
I'm trying to do the same with phptemplate.....do you have a link to another site that you would like your forum to look like?
I don't like phpbb style forums, so, I'm trying to come up with something a bit different. The terminus1525.ca forum looks good...but I'm trying to move towards a threaded discussion board, rather than a phpbb forum style.
Would be insteresting to know how you are approaching it and what you're desired result is. Maybe we can help each other...
As an indicator to where I'm going with it, click on this link to a UK music Industry message board...which doesn't look as sexy as the terminus forum, but the ergonomics are unbeatable.
http://www.recordoftheday.com/mb
I'm trying to replicate that threaded style in drupal and offer users an option of clicking on a terminus1525 style category overview. i.e. when a vistor goes to the forum they are displayed with a screen full of the recent discussion points. While at the same time they have the option of clicking on a "discussion categories" link...either in a sidebar or in a link.
Displaying the "recent posts" instead of the "forum categories" is better I think. When I come in here, (drupal.org) I tend to click on "recent posts" first, rather than "forums".
Hope that makes sense..I suppose I'm trying to get the best of both worlds. And after using the record of the day message board a few times, I think the ergonomics is bang on.
Furthermore, I like the fact that the server doesn't have to do as much work. For a busy message board that is essential.
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
I was looking more-so at Drupal based sites
I like that style as well, I like floating threads to the top based on "last post by time", so the most recently active are at the top.
I was most interested in gaining access to the actual place in Drupal that the forum "block" is produced. Where does it do the actual HTML?
From there I'm sure we could hack it into almost anything we desired.
Best,
Matthew
I'm guessing it's...
...if you're using phptemplate, I'm guessing it's in the comment.tpl.php and node.tpl.php you should be looking at.
As a by the way...if you manage to get the RECENT FORUM POSTS link working properly in drupal, please let me know..have been trying for ages to get that working.
It's supposed to display the RECENT FORUM POSTS, but, it just gives a list of everything posted to the site, i.e. it doesn't filter out forum posts.
I'm working on something else at the moment, but, I remember seeing this thread that I was going to go back to in the handbook pages which might work for creating a forum.tpl.php type custom layout for the forums.
http://drupal.org/node/17565
Hope that helps..
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
I think the thing is how the
I think the thing is how the style sheet works. Looking at the very first thing posted above you can see there are no comments for the main articles.
Moreover, the DIVs are named different things. On my site you can see an example of how I've set the comments up:
http://ishotthedeputy.com/?q=node/view/227
Now the style sheet allows me to make all the nodes look the same and I could put avatar pictures to the left by using the Float option too - the code is there in the Xtemplate form for putting these things up.
The problem is that the first post in the forum is given a DIV class of "node" and the replies are given id/classes of "comment".
Now on http://www.terminus1525.ca/node/view/8086 you can see that the first post has a class of "post" and the later ones a class of "postsecondary", hence they can be styled differently to other content on the site.
This is presumably achieved by adding new hooks into the theme and calling them when creating the forum.
Still more importantly, all the forum posts occur within a DIV of id="forumposts" class="content", so there is an extra ID tag to allow for formatting.
To format the forum as you like I would say you shouldn't need more than a few extra lines in the code to create new DIVs for forum posts compared to others and then use CSS to control the look.
As for the Tracker...well we'll just keep looking into that, I reckon! ;)
phptemplate overrides will do that for you..
Hi Theo,
I laughed out loud at your tracker comment. I think that question is going to run and run.
I see exactly what you mean about the definition of the DIVs and naming them in such a way that you can control them using the style sheet.
I wonder if this is of any use to you...a while back I needed to override the user profile pages. I created a handbook page which is no longer referenced, but the old post is still there...
http://drupal.org/node/16011
When I created the user_profile.tpl.php override I was able to determine precisely what the DIVs & styles were called when the HTML was being produced for the profile pages.
hence I was able to control precisely how it looked using my style sheet.
So I think the answer to your question is to create an override or edit the comment.tpl.php file and change how the DIVs are named...
Hope that makes sense...there is a good handbook page on creating new template files here. http://drupal.org/node/17565
Please post back up here with how you get on...'ll be trying something similar soon..although more threaded and discussion board based rather than just adding comments to a node.
Will try and chip in if I have time and I can help with what you are doing..
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
addendum...
oops..sorry...just noticed this comment from Steven about the comment.tpl.php file:
So I'm not sure if editing the comment.tpl.php file will achieve what you want..you can change how the actual comment looks, but, it doesn't help you with the threading.
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Yeah, but the threading that
Yeah, but the threading that he's talking about is part of Drupal as standard. He wants a Slashdot style indentation that the use can select already when viewing the site (it's certainly there on my site, offering flat or threaded, headings only or not).
He could remove that selection and force it to be in a given view state.
Cheers for the template information Dub. I actually realise I have no idea what PHP template is so I'll have to investigate. I was just going through the Forum and Node code to see what I would have to alter to adjust all the bits to get it to write what I wanted. Instead I'll look at the PHP thing
EDIT: I see that these templates are only available on 4.5 or up and I'm still running on 4.4.2. I guess I need to take that week off work so I can upgrade the site. *sigh*
the threading...
I see what you mean re: threading..forgot about the way that can be tweaked.
And you're right, probably better to remove the selection and force it on users...as it does on drupal.org.
I'm going to have to look into that at some stage. THanks for the heads up. Am working on something else and won't be doing my forum layout thing for a while, but will post back up here if I discover anything worth noting..
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
This is where I got stuck
I'm pretty decent at working with CSS, and I'd love to be at the point where styling the forums was just a matter of some CSS and a few lines of PHP... but...
Where in the PHP code would I change the forums to have specialized div tags?
if I edit node.tpl.php & comment.tpl.php won't that change node & comment styles for the entire site?
Should I be doing something like this at the top of those two files? Will this allow me the control I desire?
I'm not sure how I would catch the actual "read a forum thread" page, as it would have arg(0) of node, just like other pages in the site.
Best,
Matthew
Hmm.I think, and I'm drunk
Hmm.
I think, and I'm drunk now and I've lost the thread of the posts, that you need to create a new theme hook.
When writing a page the 'theme()' function is called. Now the template can override this but otherwise the default function is used from theme.inc in the includes folder.
If you created your own hook that you forced to run on forum_page() or similar you could conceivably run a whole separate line of code for that run, though I'm not fully clear how easy this would be.
It might take a bit of searching but it should be possible to provide programs specifically for forums, I hope!
Theme hooks eh?
Ok. So I can do that. I'm not afraid of a little PHP =]
...anyone who can tell me where the current forum hook is would be my best friend. I'd love to be able to have some form of an example to work from. I think perhaps I should dive into the manual and drupal api.
Best,
Matthew
I think...
I think these references might help...
http://drupaldocs.org/api/4.5/group/themeable
Check out the following forum hooks and examples...
I stand corrected, but themeable hooks in drupal means that you can control them using a theme, without hacking ..just using a theme override. As I understand it php template allows you to do that relatively easily with php based
.tplfiles..theme_form_element
Return a themed form element.
theme_forum_display
Format the forum body.
theme_forum_list
Format the forum listing.
theme_forum_topic_list
Format the topic listing.
Hope that helps or inspires..
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
CSS got me the forum listing pages...
OK. So I was able to work with some fancy URL checking via PHP and some CSS styles to make the forum lists look good... but now how can I style the actual thread pages?
These pages have URL's like... node/1 and comment/reply/1. I don't want to change the way that *normal* nodes (pages) look, rather I want only to change the way the FORUM nodes are displayed. How might I do that?
arg(x)won't help much, asarg(0) = 'node'for the forum pages AND the normal pages.I can't even do a CSS trick like
#forum #comment { ... }because the forum nodes don't have the #forum div tag in them - they are totally, 100%, normal nodes....which begs the question.. how does Terminus1525 style the forum message pages like they do at http://www.terminus1525.ca/node/view/14381? There isn't really a phptemplate override for that, is there? How can I tell I'm at a forum node, and not another term's node?
Best,
Matthew
Isn't something like (in
Isn't something like (in node.tpl.php):
what you are looking for? So you can check what type the node is and do something different if it is a "forum" type of page.
Not tested.
Robrecht
Forum Topics have a special
Forum Topics have a special name, though, don't they? As in they are a special type of node and they must 'know' it because if you insert the 'email this page' module, then on a forum page (unless you change the setting) it says 'email this forum'.
So you need some sort of hook in the main node display that checks the type and writes a DIV of the same name maybe.
Did that make sense? I need breakfast.
Good idea
I'll have to try this later on today. Also, I too have seen modules that are able to alter their links when referenced from a forum node. I'm sure theres a way.. and I've certainly got the will =]
Thanks for all the suggestions... now if only I can figure out how to list vocabularies and all their related terms..
Best,
Matthew
Have a look at the
Have a look at the syndication add-on module for the vocabulary thing - that builds syndications based on vocab but it needs the Taxonomy DHTML add-on too... The answer may be there.
This was it!
I just wanted to let you know that this is how to tell the difference between a forum post
$node->type == 'forum'and a normal page in my site$node->type == 'page'. Now I can do this at the top of node.tpl.php to specially style my forum post pages via a separate forum.tpl.php template...Thank you,
Matthew
Already supported in PHPTemplate
Actually, the latest PHPTemplate should already see and use any node-type.tpl.php files ;).
Oh well, at least you learnt something new about Drupal...
--
If you have a problem, please search before posting a question.
apologies if this is a stupid question..but..
Hi Steven,
Just wondering (and apologies in advance if this is a stupid question), but is it possible to override the page.tpl.php files in the same way?
i.e. I'm looking at customizing the forum look n feel on a site I'm working on and I'm planning to make it a full screen forum with a link back to the main site.
I know there are a lot of ways of doing that, but, I was following this discussion and was wondering - with the new phptemplate, overriding node.tpl.php files for specific node types seems to be a breeze - if it is possible to do the same with page.tpl.php files?
I have a sneaking suspicion that is a stupid question..but, I thought I'd ask.
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
It seems
It seems matthew's code above achieves that. (I've been using something like that for a contributed theme I'm working on. If there's a more elegant method, I'm all for it!)
Combined with a node-forum.tpl.php template file, its seems that forums could be largely re-themed. Some thoughtful block configuration settings could make the forums totally different from the rest of the site.
.:| Laura • pingV |:.
_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet
I must amend
Use of the conditional above for arg(0) works for display of all forum pages, but once you get to the forum post, you're back to the default page.tpl.php. It's almost there, but not quite.
If anyone has an idea on how to pull up a customized 'page-forum.tpl.php' template page when displaying a forum post, it would be greatly appreciated here. I'm working on a community site that is to have quite distinct forums, and simply modifying the node-forum.tpl.php template file isn't quite enough.
Thanks!
===
Laura
pingV
_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet
Sadly i dont think we can
Sadly i dont think we can override the page.tpl.php in the same way. I wish we coudl it would solve the problems i am currently having.
You could do it in in a template.php file
You can do
--
The future is so Bryght, I have to wear shades.
I didn't know that's how it worked...
I saw that in the phpTempate manual part of the handbook, but it was not clear on how to use it. I thought that I needed to do an override in template.php, and when that didn't work I couldn't think of anything else to try.
Perhaps it'd be good to make a list of all the different types of nodes, and the proper name for a file to make to override it (ie, Forum: node-forum.tpl.php).
Thank you for the information at any rate!!
Best,
Matthew
Have a great day™
doesn't work
Hi! I made file named node-forum.tpl.php but it doesn't work. What I make wrong? I've tried everything but I still don't know how to change design of my forum. Could anyone help me? I'm really desperate...
Hi guys,
Hi guys,
I've written a brief tutorial on theming the forums so that they look like phpBB. You can read it here:
http://www.drupalart.org/phpbb
Let me know if it helps at all...
Farsheed
great job
Great job Farsheed...that drupalart site is turning into a real gem.
had a quick look at the forum styling you have done and it is very well done.
Cheers
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Ok.. I have done all that now what?
Ok.. I have done all that now what?
I created your files and uploaded them and refreshed the site, Is there a step I am missing to get the files activated so my forums look that way?
I also refreshed the themes directory.
By the way your forms are great looking, cant wait to get mine going.
Life is Short, Use a little Logic and you might extend it :-)
well it works
Well it works
After some CSS tweaking (back to what it started as )
The forums are working and they look nice and simple yet smooth.
You can check them out at www.gecko13.com
Life is Short, Use a little Logic and you might extend it :-)
Letting you know --
It helps immensely.
I did post a problem I'm having there in the comments for this post, but overall I'm already much much happier.
I don't need to HAVE phpbb -- I just need things to look enough like it so users won't revolt. LOL
Revolting users... hehhe..
Revolting users... hehhe.. funny...
Anyway. I managed to get what i want. This thread helped alot. I think this info should be added to the handbook.
Somewhere like -> http://drupal.org/node/23348
But my problem is clumsy code, as i cant understand php entirely.
This made the page.tpl.php file to be huge in filesize. Could someone please show me how to improve my page.tpl.php, so it could be shorter and only one time between php tags, not 3 times + theme content, as it is now. I would be very greatful.
Please...
drupalart-theming with 4.7
is anyone using the drupalart-phpbb-theming with drupal-4.7?
has someone made it compatible? i made some changes, but still have problems with it .(
many thanks,
tichy