Ignore:
Timestamp:
07/05/10 13:52:23 (23 months ago)
Author:
fuze
Message:

Модуль "последнее в блогах" вынесен в шаблон

File:
1 edited

Legend:

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

    r181 r225  
    4747                 
    4848                $result = $inDB->query($sql); 
     49                $is_blog = false; 
     50                if ($inDB->num_rows($result)){   
    4951                 
    50                 if ($inDB->num_rows($result)){   
    51                         echo '<table cellspacing="2" cellpadding="4" border="0">'; 
    52  
     52                        $is_blog = true; 
    5353            $count = 1; 
    54  
     54                        $posts = array(); 
     55                         
    5556                        while($con = $inDB->fetch_assoc($result)){ 
    5657 
     
    6768                    } 
    6869 
    69                     $link = $model->getPostURL(null, $con['bloglink'], $con['seolink']); 
    70                     $text = strip_tags($con['title']); 
    71  
    72                     if (strlen($text)>70) { $text = substr($text, 0, 70). '...'; } 
    73                     echo '<tr>'; 
    74                         echo '<td valign="top">'; 
    75                         echo '<a class="mod_blog_userlink" href="'.$model->getBlogURL(null, $con['bloglink']).'">'.$con['blog'].'</a> &rarr; '; 
    76  
    77                         echo '<a class="mod_blog_link" href="'.$link.'">'.$text.'</a> ('.$inCore->dateFormat($con['fpubdate']).')</td>'; 
    78                     echo '</tr>'; 
     70                    $con['href']         = $model->getPostURL(null, $con['bloglink'], $con['seolink']); 
     71                    $con['title']        = strip_tags($con['title']); 
     72                                        if (strlen($con['title'])>70) { $con['title'] = substr($con['title'], 0, 70). '...'; } 
     73                                        $con['fpubdate'] = $inCore->dateFormat($con['fpubdate']); 
     74                                        $con['bloghref'] = $model->getBlogURL(null, $con['bloglink']); 
    7975 
    8076                    $count++; 
    8177 
    8278                } 
    83  
     79                                $posts[] = $con; 
    8480                        } 
    85  
    86                         echo '</table>'; 
    87  
    88                         if ($cfg['showrss']){ 
    89                                 echo '<table align="right" style="margin-top:5px"><tr>'; 
    90                                         echo '<td width="16"><img src="/images/markers/rssfeed.png" /></td>'; 
    91                                         echo '<td><a href="/rss/blogs/all/feed.rss" style="text-decoration:underline;color:#333">'.$_LANG['LATESTBLOGS_RSS'].'</a></td>'; 
    92                                 echo '</tr></table>'; 
    93                         }                                
    94                 } else { echo '<p>'.$_LANG['LATESTBLOGS_NOT_POSTS'].'</p>'; } 
     81                 
     82                }  
     83                 
     84                $smarty = $inCore->initSmarty('modules', 'mod_latestblogs.tpl');                         
     85                $smarty->assign('posts', $posts); 
     86                $smarty->assign('cfg', $cfg); 
     87                $smarty->assign('is_blog', $is_blog); 
     88                $smarty->display('mod_latestblogs.tpl');         
    9589                 
    9690                return true; 
Note: See TracChangeset for help on using the changeset viewer.