Changeset 225


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

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

Location:
branches/fuze
Files:
2 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; 
  • branches/fuze/templates/_default_/modules/mod_latestblogs.tpl

    r181 r225  
     1{if $is_blog} 
    12<table width="100%" cellspacing="0" cellpadding="5" border="0" > 
    23{foreach key=tid item=post from=$posts} 
    34        <tr> 
    4                 <td class="mod_blog_karma">{$post.karma}</td> 
    55                <td> 
    66                        <div> 
    77                                <a class="mod_blog_userlink" href="{$post.bloghref}">{$post.blog}</a> &rarr;  
    8                                 <a class="mod_blog_link" href="{$post.href}">{$post.title}</a> ({$post.date}) 
     8                                <a class="mod_blog_link" href="{$post.href}">{$post.title}</a> ({$post.fpubdate}) 
    99                        </div> 
    1010                </td> 
     
    1212{/foreach} 
    1313</table> 
     14{if $cfg.showrss} 
     15    <a href="/rss/blogs/all/feed.rss" class="mod_latest_rss">{$LANG.LATESTBLOGS_RSS}</a> 
     16{/if} 
     17{else}             
     18<p>{$LANG.LATESTBLOGS_NOT_POSTS}</p> 
     19{/if} 
Note: See TracChangeset for help on using the changeset viewer.