Changeset 220


Ignore:
Timestamp:
07/02/10 16:07:08 (19 months ago)
Author:
fuze
Message:

Модуль "последние комментарии": html вынесен в шаблон.

Location:
branches/fuze
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/fuze/modules/mod_comments/module.php

    r181 r220  
    5757 
    5858        $result = $inDB->query($sql); 
    59  
     59                $is_com = false; 
    6060        if ($inDB->num_rows($result)){ 
    61  
     61                        $is_com = true; 
    6262            $count = 0; 
    63  
    64             echo '<table cellspacing="2" cellpadding="4" border="0">'; 
     63                        $comments = array(); 
    6564            while($con = $inDB->fetch_assoc($result)){ 
    6665 
     
    6968                if ($con['rating'] >= $cfg['minrate']){ 
    7069 
    71                     $link = $con['target_link'] . '#c'.$con['id']; 
    72                     $text = strip_tags($inCore->parseSmiles($con['content'], true)); 
     70                    $con['link'] = $con['target_link'] . '#c'.$con['id']; 
     71                    $con['text'] = strip_tags($inCore->parseSmiles($con['content'], true)); 
     72                    if (strlen($con['text'])>60) { $con['text'] = substr($con['text'], 0, 60). '...'; } 
     73                    if (!$con['text']) { $con['text'] = '...'; } 
    7374 
    74                     if (strlen($text)>50) { $text = substr($text, 0, 50). '...'; } 
     75                    $con['user_url'] = $con['user_id'] ? cmsUser::getProfileURL($con['author_login']) : $con['link']; 
     76                    $con['author']   = $con['user_id'] ? $con['author'] : $con['guestname']; 
     77                    $con['fpubdate'] = $inCore->dateFormat($con['fpubdate']); 
    7578 
    76                     if (!$text) { $text = '...'; } 
    77  
    78                     $user_url = $con['user_id'] ? cmsUser::getProfileURL($con['author_login']) : $link; 
    79                     $author   = $con['user_id'] ? $con['author'] : $con['guestname']; 
    80  
    81                     echo '<tr>'; 
    82                         echo '<td valign="top">'; 
    83                             echo '<div><a class="mod_com_userlink" href="'.$user_url.'">'.$author.'</a> &rarr; '; 
    84                         echo '<a class="mod_com_link" href="'.$link.'">'.$text.'</a> ('.$inCore->dateFormat($con['fpubdate']).')</td>'; 
    85                     echo '</tr>'; 
    86  
    87                     $count++; 
    88  
     79                                        $comments[] = $con; 
     80                                        $count++; 
    8981                } 
    9082 
    9183            } 
    92             echo '</table>'; 
    9384 
    94             if ($cfg['showrss']){ 
    95                 echo '<table align="right" style="margin-top:5px"><tr>'; 
    96                     echo '<td width="16"><img src="/images/markers/rssfeed.png" /></td>'; 
    97                     echo '<td><a href="/rss/comments/all/feed.rss" style="text-decoration:underline;color:#333">'.$_LANG['COMMENTS_RSS'].'</a></td>'; 
    98                 echo '</tr></table>'; 
    99             } 
    100         } else { echo '<p>'.$_LANG['COMMENTS_NOT_COMM'].'</p>'; } 
    101                                  
     85        }  
     86                 
     87                $smarty = $inCore->initSmarty('modules', 'mod_comments.tpl');                    
     88                $smarty->assign('comments', $comments); 
     89                $smarty->assign('cfg', $cfg); 
     90                $smarty->assign('is_com', $is_com); 
     91                $smarty->display('mod_comments.tpl');    
     92                         
    10293                return true; 
    10394} 
  • branches/fuze/templates/_default_/css/styles.css

    r216 r220  
    393393        height:16px; 
    394394        line-height:16px; 
     395        text-decoration:underline; 
     396        color:#333 
    395397} 
    396398 
     
    602604        color:#666666; 
    603605} 
    604  
     606.mod_com_line{ 
     607margin:7px 0; 
     608} 
    605609/*--------------------- MODULE "LATEST FORUM WEB2.0" -------------------------*/ 
    606610.mod_fweb2_userlink{ 
Note: See TracChangeset for help on using the changeset viewer.