(Solved) Alternating Comment Background

joshrodgers

Joined: 2008-08-31
Posts: 5
Posted: Fri, 2008-12-05 22:00

Ok,

The idea is really simple. In a nutshell...the page is at: http://ourpictureshare.com/gallery2/main.php?g2_itemId=127. What I am trying to do is alternate the background colors, so the comment with the subject of "Test" would have a grey background, the comment with the subject of "Oops" would have a white background, and the comment with the subject of "Great Picture" would have a grey background. Any ideas? Thanks,

Josh

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2008-12-06 03:07

You need to edit the comment module template:
gallery2/modules/templates/ShowComments.tpl
in the for each you can use the smarty cycle function:
http://www.smarty.net/manual/en/language.function.cycle.php
to change the BG color or change the class of the <div> and then add a new class to you css to change the color.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
joshrodgers

Joined: 2008-08-31
Posts: 5
Posted: Sun, 2008-12-07 18:37

floridave,

Thanks for the help! After experimenting I actually had to edit gallery2/modules/templates/blocks/ViewComments.tpl, however the Smarty function worked like a charm! Thanks,

Josh

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2008-12-07 18:51

Great! Perhaps you can share what you did with others.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
joshrodgers

Joined: 2008-08-31
Posts: 5
Posted: Sun, 2008-12-07 21:17

You bet. I replaced:

<div class="one-comment gcBorder2">
{include file="gallery:modules/comment/templates/Comment.tpl"
user=$block.comment.LoadComments.commenters[$comment.commenterId]
comment=$comment
can=$block.comment.LoadComments.can
item=$block.comment.LoadComments.item
truncate=256}
</div>

with:

<table>
<tr bgcolor="{cycle values='#eeeeee,#d0d0d0'}">
<td>

{include file="gallery:modules/comment/templates/Comment.tpl"
user=$block.comment.LoadComments.commenters[$comment.commenterId]
comment=$comment
can=$block.comment.LoadComments.can
item=$block.comment.LoadComments.item
truncate=256}

</td>
</tr>
</table>

Its not pretty and I am trying to see how I can apply it to a div, but it does work. Thanks again,

Josh