Customizing SMF > SMF Coding Discussion

Online and offline images change

(1/2) > >>

spiros:
I am trying to change the images to Font Awesome icons. I find it a bit complex to adapt the following string in display.template. I want to replace with those two (online and offline image respectively)


--- Code: ---<i class="far fa-comment-dots fa-lg"></i>
<i class="far fa-comment" fa-lg></i>

--- End code ---

Here is the string:


--- Code: ---// Since we know this person isn't a guest, you *can* message them.
if ($context['can_send_pm'])
echo '
<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '" class=" tooltip">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '" />' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
--- End code ---

vbgamer45:
Try something like

--- Code: ---<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '" class=" tooltip">', $settings['use_image_buttons'] ? '($message['member']['online']['is_online'] ? '<i class="far fa-comment-dots fa-lg"></i>' : <i class="far fa-comment" fa-lg></i>')  : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';

--- End code ---

spiros:
Thanks! I got: syntax error, unexpected 'member' (T_STRING)

vbgamer45:
Corrected here

--- Code: ---<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '" class=" tooltip">', $settings['use_image_buttons'] ? ($message['member']['online']['is_online'] ? '<i class="far fa-comment-dots fa-lg"></i>' : '<i class="far fa-comment" fa-lg></i>')  : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';

--- End code ---

spiros:
Thanks again!

Now: syntax error, unexpected '/'

I think it was wise of me not to try, if it gives you pain... then I would stand no chance.

I think one can test quickly here:
https://phpcodechecker.com/

Navigation

[0] Message Index

[#] Next page

Go to full version