Чёт подзапутался.
Забираем из базы (в ней новое текстовое поле, в которое успешно записываются данные, site_link varchar 200)
model.php
public function getCommentsAll($page=1, $perpage=10){ global $_LANG; $inUser = cmsUser::getInstance(); $hidden_sql = $inUser->is_admin ? '' : 'AND c.is_hidden=0'; $sql = "SELECT c.id, c.guestname, c.site_link, c.content, c.pubdate as fpubdate, c.target_title, c.target_link, c.ip, c.user_id, IFNULL(v.total_rating, 0) as votes, IFNULL(u.nickname, 0) as nickname, IFNULL(u.login, 0) as login, IFNULL(u.is_deleted, 0) as is_deleted, IFNULL(p.imageurl, 0) as imageurl, IFNULL(p.gender, 0) as gender FROM cms_comments c LEFT JOIN cms_ratings_total v ON v.item_id = c.id AND v.target = 'comment' LEFT JOIN cms_users u ON u.id = c.user_id LEFT JOIN cms_user_profiles p ON p.user_id = u.id WHERE c.published=1 {$hidden_sql} ORDER BY c.id DESC LIMIT ".(($page-1)*$perpage).", $perpage"; $result = $this->inDB->query($sql); if (!$this->inDB->num_rows($result)) { return false; } while($comment = $this->inDB->fetch_assoc($result)){ $comment['fpubdate'] = cmsCore::dateFormat($comment['fpubdate'], true, true); switch ($comment['gender']){ case 'm': $comment['gender'] = $_LANG['COMMENTS_MALE']; break; case 'f': $comment['gender'] = $_LANG['COMMENTS_FEMALE']; break; default: $comment['gender'] = $_LANG['COMMENTS_GENDER']; } $comments[] = $comment; } $comments = cmsCore::callEvent('GET_COMMENTS', $comments); return $comments; }
// Если есть комментарии, выбираем и обрабатываем if ($total){ $comments_list = $model->getCommentsAll($page, $perpage); foreach($comments_list as $comment){ $comments[$next] = $comment; if ($comments[$next]['guestname']) { $comments[$next]['author'] = $comments[$next]['guestname']; $comments[$next]['is_profile'] =false; $comments[$next]['ip'] = (($cfg['cmm_ip'] == 1 || $cfg['cmm_ip'] == 2) && $comments[$next]['ip']) ? '('.$comments[$next]['ip'].')' : false; } else { $comments[$next]['author']['nickname'] = $comments[$next]['nickname']; $comments[$next]['author']['login'] = $comments[$next]['login']; $comments[$next]['is_profile'] = true; $comments[$next]['user_image'] = usrImageNOdb($comments[$next]['user_id'], 'small', $comments[$next]['imageurl'], $comments[$next]['is_deleted']); $comments[$next]['ip'] = ($cfg['cmm_ip'] == 2 && $comments[$next]['ip']) ? '('.$comments[$next]['ip'].')' : false; } $comments[$next]['show'] = ((!$cfg['min_karma'] || $comments[$next]['votes']>=$cfg['min_karma_show']) || $inCore->userIsAdmin($comments[$next]['user_id'])); if ($comments[$next]['votes']>0){ $comments[$next]['votes'] = '<span class="cmm_good">+'.$comments[$next]['votes'].'</span>'; } elseif ($comments[$next]['votes']<0){ $comments[$next]['votes'] = '<span class="cmm_bad">'.$comments[$next]['votes'].'</span>'; } } } $inPage->addHead('<link rel="alternate" type="application/rss+xml" title="'.$_LANG['BOARD'].'" href="'.HOST.'/rss/comments/all/feed.rss">'); // Отдаем в шаблон $smarty = $inCore->initSmarty('components', 'com_comments_list_all.tpl'); $smarty->assign('site_link', $site_link);
Заранее спасиб)