Page 1 of 1

adding more colors?

Posted: Fri Mar 14, 2003 9:05 pm
by RMS
There is something I was trying to change within my viewtopic file but I can't seem to figure out how so I was hoping someone could help me.

I was trying to change it so that as there are alternating background colors for every other poster's stuff, if it would be possible to divide that into 4 different colors so that the left hand column (with the names, avatars etc) and the text column backgrounds are different? And if possible, how to set it so that I can change it in the ACP or something so it doesn't have to be hardcoded?

Posted: Fri Mar 14, 2003 9:13 pm
by Arty
You can set only 2 colors, not 4.

Every post has {postrow.ROW_CLASS} which is ether row1 or row2.

Here is original code for that row (in viewtopic_body.tpl):

Code: Select all

		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen">&</span>& &{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
				<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
			</tr>
			<tr> 
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
			</tr>
		</table></td>
To set different colors for posts/poster_info you can do this:

Code: Select all

		<td width="150" align="left" valign="top" class="poster_{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
		<td class="post_{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen">&</span>& &{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
				<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
			</tr>
			<tr> 
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
			</tr>
		</table></td>
I changed class from class="{postrow.ROW_CLASS}" to class="poster_{postrow.ROW_CLASS}" and class="post_{postrow.ROW_CLASS}". That creates 4 new classes: "poster_row1", "poster_row2", "post_row1", "post_row2" and you can use it to set different background for different columns.

And you cannot do it from control panel - you need to edit tpl and css yourself.

Posted: Fri Mar 14, 2003 11:44 pm
by RMS
...hmm, I see. Exactly which other file do I have to edit to set the colors?

Posted: Sat Mar 15, 2003 12:31 am
by Arty
that html code is in viewtopic_body.tpl and you shoud add classes to overall_header.tpl or stylename.css

Posted: Sat Mar 15, 2003 3:38 pm
by RMS
Ah ok. Thanks :)