Changeset 229


Ignore:
Timestamp:
07/06/10 13:08:59 (19 months ago)
Author:
fuze
Message:

Модуль "новинки фотогалереи" вынесен в шаблон

Location:
branches/fuze
Files:
1 added
1 edited

Legend:

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

    r181 r229  
    2626 
    2727        if (!$cfg['showclubs']) { $catsql .= " AND a.NSDiffer=''"; } 
    28                  
    29                 $col = 1; $maxcols = $cfg['maxcols']; 
    3028 
    3129                $sql = "SELECT f.*, f.pubdate as fpubdate, a.id as album_id, a.title as album 
     
    3634         
    3735                $result = $inDB->query($sql); 
    38                          
     36                $is_photo = false;       
     37                 
    3938                if ($inDB->num_rows($result)){   
    40                         $photos = array();                       
    41                         echo '<table cellspacing="2" border="0" width="100%">'; 
     39                        $photos = array();               
     40                        $is_photo = true;        
     41                                 
    4242                        while($con = $inDB->fetch_assoc($result)){ 
    43                                 if ($col==1) { echo '<tr>'; } echo '<td align="center" valign="middle" class="mod_lp_photo" width="'.round(100/$maxcols, 0).'%">'; 
    44                                 echo '<table width="100%" height="100" cellspacing="0" cellpadding="0">'; 
    4543                                if ($cfg['showtype']=='full'){ 
    46                                         echo '<tr><td align="center"><div class="mod_lp_titlelink"><a href="/photos/photo'.$con['id'].'.html" title="'.$con['title'].'">'.$con['title'].'</a></div></td></tr>'; 
    47                                 } 
    48                                 echo '<tr> 
    49                                           <td valign="middle" align="center">'; 
    50                                                 echo '<a href="/photos/photo'.$con['id'].'.html" title="'.$con['title'].'">'; 
    51                                                         echo '<img class="photo_thumb_img" src="/images/photos/small/'.$con['file'].'" alt="'.$con['title'].'" border="0" />'; 
    52                                                 echo '</a>'; 
    53                                 echo '</td></tr>'; 
    54                                 if ($cfg['showtype']=='full'){ 
    55                                         echo '<tr>'; 
    56                                         echo '<td align="center">'; 
    57                                                 if($cfg['showalbum']){ 
    58                                                         echo '<div class="mod_lp_albumlink"><a href="/photos/'.$con['album_id'].'" title="'.$con['album'].'">'.$con['album'].'</a></div>'; 
    59                                                 } 
    6044                                                if($cfg['showcom'] || $cfg['showdate']){ 
    61                                                         echo '<div class="mod_lp_details">'; 
    62                                                         echo '<table cellpadding="2" cellspacing="2" align="center" border="0"><tr>'; 
    6345                                                                if ($cfg['showdate']){ 
    64                                                                         echo '<td><img src="/images/icons/date.gif" border="0"/></td>'; 
    65                                                                         echo '<td>'.$inCore->dateFormat($con['fpubdate']).'</td>'; 
     46                                                                        $con['fpubdate'] = $inCore->dateFormat($con['fpubdate']); 
    6647                                                                } 
    6748                                                                if ($cfg['showcom']){ 
    68                                                                         echo '<td><img src="/images/icons/comments.gif" border="0"/></td>'; 
    69                                                                         echo '<td><a href="/photos/photo'.$con['id'].'.html#c">'.$inCore->getCommentsCount('photo', $con['id']).'</td>'; 
     49                                                                        $con['comments'] = $inCore->getCommentsCount('photo', $con['id']); 
    7050                                                                } 
    71                                                         echo '</tr></table>'; 
    72                                                         echo '</div>'; 
    7351                                                } 
    74                                         echo '</td>'; 
    75                                         echo '</tr>'; 
    7652                                } 
    77                                 echo '</table>'; 
    78                                 //echo '</div>'; 
    79                                  
    80                                 echo '</td>'; if ($col==$maxcols) { echo '</tr>'; $col=1; } else { $col++; } 
     53                                $photos[] = $con;        
    8154                        }                        
    82                         if ($col>1) { echo '<td colspan="'.($maxcols-$col+1).'">&nbsp;</td></tr>'; } 
    83                         echo '</table>'; 
    84                         if ($cfg['showmore']){ 
    85                                 echo '<div style="text-align:right"><a style="text-decoration:underline" href="/photos/latest.html">Âñå íîâûå ôîòî</a> &rarr;</div>'; 
    86                         } 
    87                 } else { echo '<p>Íåò ìàòåðèàëîâ äëÿ îòîáðàæåíèÿ.</p>'; } 
     55                } 
    8856                 
     57                $smarty = $inCore->initSmarty('modules', 'mod_latestphoto.tpl');                         
     58                $smarty->assign('photos', $photos); 
     59                $smarty->assign('cfg', $cfg); 
     60                $smarty->assign('is_photo', $is_photo);                  
     61                $smarty->display('mod_latestphoto.tpl'); 
    8962                                 
    9063                return true; 
Note: See TracChangeset for help on using the changeset viewer.