Hi

Well i was trying to edit the support ticket template of whmcs and there is the following code

{foreach key=num item=reply from=$replies}

<tr class="supportticketsheading"><td width="160" rowspan="2" valign="top">{$reply.user}</td><td>{$LANG.supportticketsposted}: {$reply.date}</td>
</tr>
<tr class="supportticketscontent"><td valign="top">{$reply.message}{if $reply.attachment}<br /><br /><img src="images/support/folder.gif" align="middle" alt="" /> <i>{$LANG.supportticketsticketattachment}: <a href="{$reply.attachmentlink}">{$reply.attachment}</a></i>{/if}</td></tr>

{/foreach}

and what i want to do is that the customer reply should be one colour and the staff another colour but the problem is that the replies are taken using the foreach loop therefore if i change the colour of it then all the staff and customer replies will change to that colour

Is there any way i can make them both different colours?

Thanks a lot in advance for all the help :D

Dani AI

Generated

As suggested, the right approach is to give each reply a semantic class (staff vs client) and style those classes in your CSS. Below are a compact CSS example and a small template pattern to drop into the reply output (inside your existing foreach). If the staff/client marker used by your WHMCS version is different, use the quick debug tips afterwards to find the correct key.

CSS (put into your template stylesheet)

.ticket-reply.client {
  background: #f7f7f7;
  border-left: 4px solid #ccc;
  padding: 8px;
}

.ticket-reply.staff {
  background: #f0f8ff;
  border-left: 4px solid #2b7bd9;
  padding: 8px;
}

Template pattern (inside the reply loop; change the condition to the flag your WHMCS exposes)

<tr class="supportticketsheading ticket-reply {if $reply.admin}staff{else}client{/if}">
  <td>{$reply.user}</td>
  <td>{$reply.date}</td>
</tr>
<tr class="supportticketscontent ticket-reply {if $reply.admin}staff{else}client{/if}">
  <td colspan="2">{$reply.message}</td>
</tr>

Troubleshooting

  • If every row ends up the same, the template may not expose $reply.admin in your WHMCS version. Inspect the reply array with {debug} or temporarily output {$reply|@print_r} to see available keys (look for names like admin, adminid, or userid).
  • After editing, clear WHMCS/Smarty compiled templates (delete files in templates_c) and refresh the page.
  • Keep styles in your CSS file rather than inline, and check color contrast for readability.

This gives per-reply classes while preserving your loop. Adjust the conditional to the exact reply key present in your installation.

create css class and implemented in between staff and user,it will be easily done

Hi, thx a lot but can you please give me an example of the code for both the css and tpl(main) file

thx in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.