Аватар в последних комментариях
На сайте есть модуль "Последние комментарии" хочу сделать, чтобы в этом модуле выводило не только тему и сообщение юзера но и его аватар.
Думаю понятно выразился, а то я люблю "закрутить" простые вещи.
include_once($_SERVER['DOCUMENT_ROOT'].'/components/users/includes/usercore.php'); } $usrimage = usrImageNOdb($usr['id'], 'small', $usr['imageurl'], $usr['is_deleted']);
$smarty->assign('avatar', $userimage);
находим запрос к БД, начинается с
$sql = "SELECT c.id as id, ...
$sql = "SELECT c.id as id, c.target as target, c.target_id as target_id, c.target_link as target_link, c.target_title, c.content as content, c.guestname, c.pubdate as fpubdate, IFNULL(c.user_id, 0) as user_id, IFNULL(u.nickname, '') as author, IFNULL(u.login, '') as author_login, up.imageurl as author_avatar, u.is_deleted as author_out, IFNULL(v.total_rating, 0) as rating FROM cms_comments c INNER JOIN cms_users u ON u.id = c.user_id {$guest_sql} LEFT JOIN cms_user_profiles up ON up.user_id = u.id LEFT JOIN cms_ratings_total v ON v.item_id=c.id AND v.target='comment' WHERE c.published=1 {$target_where} GROUP BY c.id ORDER BY c.id DESC LIMIT 70";
if (!$con['text']) { $con['text'] = '...'; }
include_once($_SERVER['DOCUMENT_ROOT'].'/components/users/includes/usercore.php'); } $con['avatar'] = usrImageNOdb($con['user_id'], 'small', $con['author_avatar'], $con['author_out']);
/public_html/templates/_default_/modules/mod_comments.tpl
в нужном месте вставляем:
{$comment.avatar}