View Full Version : Changing Comment Template
Opa114
01-24-2007, 08:20 PM
Hi!
i want to modify my comment_template.html - especially the comment output with that Code: <IMAGE_COMMENTS>
My question is: where can i find the output information, wich replaces this tag?
Example:
Now my comments are in this style:
"Comment text"
Author - Time @ Date
That's the outputformat now, but i want it that style:
Author
"Comment text"
So where can i change that?
thanks
Matthias
Dkozikowski
01-24-2007, 09:17 PM
Open includes/functions.php (make a back-up first!)
and find the following text:
$image_comments .= "<li>".nl2br($comment_message)."<br />$comment_name @ $comment_datetime</li>";
and change it to,
$image_comments .= "<li>$comment_name <br />".nl2br($comment_message)."</li>";
The above will change the commented output to,
Author
Comment text
No comment date will be included though! May i suggest the following,
$image_comments .= "<li>$comment_name @ $comment_datetime<br />".nl2br($comment_message)."</li>";
This would output,
Author @ Date
Comment text
Opa114
01-24-2007, 09:31 PM
Hey!
thank you for the quick help ;-)
i have changed it and it runs very well ;-)
thank you!
Dkozikowski
01-24-2007, 10:36 PM
Your very welcome!
Just remember, this is considered a "hack" so if you ever upgrade you will need to do this again to the new file(s)!
persianpix
01-24-2007, 11:35 PM
i'm trying to do something similar... when i try to change the color of "$comment_name" via external css, it does not follow the rules of the external css however i am able to change the color others such as "$comment_datetime" and "$comment_message".
i have even tried to change the "$commont_name"'s text color via inline css but it is still not working! i see in my comments page that the name of the commenter does have a syle but i just can't figure out where it is being ruled from!
any ideas?
thanks in advance :)
Dkozikowski
01-25-2007, 01:08 AM
A link to your pixelpost would help!
The only CSS that i can see working is if you add a rule for the <LI> and possibly the <DIV> element but that will style the whole comment instead of just the name.
persianpix
01-25-2007, 02:44 AM
looking at the code more carefully there is a <div> tag but as you have mentioned all others parameters are nested inside the same tag and yet they follow the external css. it is only the "$comment_name" that doesn't follow any sort of css instructions!
i'm actually in the process of moving my old site to pixelpost and i really don't have a set url yet.
Dkozikowski
01-25-2007, 03:52 AM
it is only the "$comment_name" that doesn't follow any sort of css instructions!
That is certainly weird.
Without seeing your template source and your CSS definitions I can't really see whats happening.
If you can post the source inside the comment <DIV> and the coresponding CSS definitions, I might be able to help you out a little more.
persianpix
01-25-2007, 04:32 AM
firstly, thanks again for your willingness to help :)
on my recent discovery, i am able to change the font size of "$comment_name" and also make it atalic via the external css but nothing else works!
i have changed the code to customize it for my design so i hope it doesn't look so clutter to you.
here is what i have in my external css:
.comment-name {
color: #FF422C;
margin-top: 13px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 13px;
font-family: "Trebuchet MS", Tahoma, Verdana, Arial, sans-serif;
font-size: 11px;
font-style: none;
text-align: left;
}
here is what i have in functions.php:
$image_comments .= "<div id=\"comment-line\"><span class=\"comment-name\">$comment_name</span> | <span class=\"comment-date\">$comment_datetime</span><br />$comment_message<br /></div>";
}
i'm still not giving up. there must be a catch somewhere!
Dkozikowski
01-25-2007, 04:41 AM
ok, real simple. try this in your CSS,
span.comment-name {
color: #FF422C;
margin-top: 13px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 13px;
font-family: "Trebuchet MS", Tahoma, Verdana, Arial, sans-serif;
font-size: 11px;
font-style: none;
text-align: left;
}
persianpix
01-25-2007, 05:04 AM
humn... it doesn't appear to do anything.
in my css when i change font-style from none to let's say italic, the changes take effect. but in the same code when i change the color code, it makes no difference. here is my logic... since some of the css code works with that parameter, i'm thinking that the issue must be the precedence order. since i'm using an external css, the in-line and document css could have higher precedence. i'm not really using any inline css. as i am looking at some other html taggs that are in the document, there is only the <div> tag that is there and i don't belive that, that tag anything to do with it!
Dkozikowski
01-25-2007, 05:18 AM
hmmm.
span.comment-name {
or even .comment-name {
should have worked. I'd make sure the rest of your CSS is valid and not messing with anything else.
Dkozikowski
01-25-2007, 05:21 AM
Also, change your DIV to a class and not an ID
<div id=\"comment-line\">
The above should be a class.
ID's are only used for single elements and that div will be re-created for every comment. Having the same ID for multiple divs will give you errors when trying to validate your code.
persianpix
01-25-2007, 05:29 AM
alright, i will the make the changes :)
in the mean time, please take a look at my site in here http://www.persianpix.com/photoblog. it's not official yet. if you click on the comment's link you will see the issue. i'm trying to change the color of the the person that leaves a comment but it remains as it is!
thanks for all your help and speedy replies.
p.s. if the above link didn't work, please enter it in your url a couple of times. it will work.
Dkozikowski
01-25-2007, 05:44 AM
i sent you a PM. you can try it but i'm not so sure now that i think about it due to the other properties having the same value and still functioning correctly.
Dkozikowski
01-25-2007, 06:21 AM
For those that are interested, and for archival purposes, the problem was in the template source itself and not in the CSS.
The template source was reading two CSS files both marked with the same "title" tag. One was the default CSS file and the other was the CSS that handled the comment styles. Anyway, for those of you who are familiar with CSS, you know you can not do this. persianpix caught onto this and removed the title tag for the comment styles from his source code and all is well.
persianpix
01-25-2007, 02:45 PM
just as a bounus, this article (http://alistapart.com/stories/alternate/) will touch base on the source of the issue :)
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.