By chiggsy on
to theme the comments in my forum i'd like to create a comment-forum.tpl.php. However it seems that this does not work like my node-forum.tpl.php does ( it does not seem to work at all ) how can i use my own template for the comments? I can clearly see that the comment template is taken from the phptemplate engines directory .. but i dont necessarily want comments to my blogs or stories to follow the same template as comments to my forums .. what to do?
Comments
i'm using this code at template.php
Assuming you have an "template.php" file in your theme folder:
them you need to create the new comment's template file called "comment_forum.tpl.php".
you can pass another variables to this new template or the other ones using the "switch" estatement.
brilliant, thank you very much
thanks a lot .. this is just what i needed...
4.6 or 4.7?
Is this approach intented to work on 4.6 or 4.7 or both? It doesn't seem to work on 4.6
I played with the code
I played with the code pacheco wrote and it didn't work for me on Drupal 5. I managed to get it to work and here's the code for template.php:
You then create node-forum.tpl.php to theme posts and comment_forum.tpl.php to theme replies to that post.
Hope I helped somebody :)
...
If you could post this as a handbook page here: http://drupal.org/node/45471 it would be more findable by folks . :)
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
Didn't work
Unfortunately this code broke my site although it's probably my fault since I'm not a coder.
I'm getting the following error:
Cannot redeclare _phptemplate_variables()So, I'm guessing there is a conflict with something else in my template.php. Any tips for fixing this?
Thanks for the help!
=-=
scan your template .php does you have two ?
_phptemplate_variables()
if so they must be merged. More information on merging can be found in the handbooks, or place a link to your template.php here using a service like pastebin.com
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Thanks!
Thanks again, VeryMisunderstood! I found this page and it took care of my problem on the first try!
phptemplate conflict
I got a suggestion from this thread to add my theme name to function _phptemplate_variables. So that line now looks like this:
function _phptemplate_variables_mythemename($hook, $vars) {I no longer get any big scary errors, but my forum isn't using my comment_forum.tpl.php file either. It's still using comment.tpl.php. The difference between the two is I'm trying to get user pictures to only display in forum comments and not other comments on the site.
Thanks for any help that can be provided.
=-=
where mythemename is the actual name of the theme you are using .... yes ?
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )