[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_plugins/other_news_menu/ -> other_news2_menu.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/other_news_menu/other_news2_menu.php,v $
  14  |     $Revision: 1.11 $
  15  |     $Date: 2006/11/23 14:53:38 $
  16  |     $Author: mcfly_e107 $
  17  +----------------------------------------------------------------------------+
  18  */
  19  if (!defined('e107_INIT')) { exit; }
  20  
  21  global $e107cache;
  22  
  23  // Load Data
  24  if($cacheData = $e107cache->retrieve("nq_othernews2"))
  25  {
  26      echo $cacheData;
  27      return;
  28  }
  29  
  30  
  31  require_once(e_HANDLER."news_class.php");
  32  unset($text);
  33  global $OTHERNEWS2_STYLE;
  34  $ix = new news;
  35  
  36  if(!$OTHERNEWS2_STYLE) {
  37      $OTHERNEWS2_STYLE = "
  38      <table class='forumheader3' cellpadding='0' cellspacing='0' style='width:100%'>
  39      <tr><td class='caption2' colspan='2' style='padding:3px;text-decoration:none;'>
  40      {NEWSCATICON}
  41      {NEWSCATEGORY}
  42      </td></tr>
  43      <tr><td  style='padding:3px;vertical-align:top'>
  44      {NEWSTITLELINK}
  45      <br />
  46      {NEWSSUMMARY}
  47      </td>
  48      <td style='padding:3px'>
  49      {NEWSTHUMBNAIL}
  50      </td>
  51      </tr>
  52      </table>
  53      ";
  54  }
  55  
  56  if(!defined("OTHERNEWS2_LIMIT")){
  57      define("OTHERNEWS2_LIMIT",5);
  58  }
  59  
  60  if(!defined("OTHERNEWS2_ITEMLINK")){
  61      define("OTHERNEWS2_ITEMLINK","");
  62  }
  63  if(!defined("OTHERNEWS2_CATLINK")){
  64      define("OTHERNEWS2_CATLINK","");
  65  }
  66  if(!defined("OTHERNEWS2_CATICON")){
  67      define("OTHERNEWS2_CATICON","border:0px");
  68  }
  69  if(!defined("OTHERNEWS2_THUMB")){
  70      define("OTHERNEWS2_THUMB","border:0px");
  71  }
  72  
  73  if(!defined("OTHERNEWS2_COLS")){
  74      define("OTHERNEWS2_COLS","1");
  75  }
  76  
  77  if(!defined("OTHERNEWS2_CELL")){
  78      define("OTHERNEWS2_CELL","padding:0px;vertical-align:top");
  79  }
  80  
  81  if(!defined("OTHERNEWS2_SPACING")){
  82      define("OTHERNEWS2_SPACING","0");
  83  }
  84  
  85  $param['itemlink'] = OTHERNEWS2_ITEMLINK;
  86  $param['thumbnail'] = OTHERNEWS2_THUMB;
  87  $param['catlink'] = OTHERNEWS2_CATLINK;
  88  $param['caticon'] = OTHERNEWS2_CATICON;
  89  
  90  $style = OTHERNEWS2_CELL;
  91  $nbr_cols = OTHERNEWS2_COLS;
  92  
  93  $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
  94  LEFT JOIN #user AS u ON n.news_author = u.user_id
  95  LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
  96  WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type=3  ORDER BY n.news_datestamp DESC LIMIT 0,".OTHERNEWS2_LIMIT;
  97  
  98  if ($sql->db_Select_gen($query)) {
  99      $text = "<table style='width:100%' cellpadding='0' cellspacing='".OTHERNEWS2_SPACING."'>";
 100      $t = 0;
 101      $wid = floor(100/$nbr_cols);
 102      while ($row = $sql->db_Fetch()) {
 103          $text .= ($t % $nbr_cols == 0) ? "<tr>" : "";
 104          $text .= "\n<td style='$style ; width:$wid%;'>\n";
 105  
 106          $text .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS2_STYLE, $param);
 107  
 108          $text .= "\n</td>\n";
 109          if (($t+1) % $nbr_cols == 0) {
 110              $text .= "</tr>";
 111              $t++;
 112          }
 113          else {
 114              $t++;
 115          }
 116      }
 117  
 118      while ($t % $nbr_cols != 0){
 119          $text .= "<td style='width:$wid'>&nbsp;</td>\n";
 120          $text .= (($t+1) % nbr_cols == 0) ? "</tr>" : "";
 121          $t++;
 122  
 123      }
 124      $text .= "</table>";
 125  
 126  
 127      // Save Data
 128      ob_start();
 129  
 130      $ns->tablerender(TD_MENU_L2, $text, 'other_news2');
 131  
 132      $cache_data = ob_get_flush();
 133      $e107cache->set("nq_othernews2", $cache_data);
 134  
 135  }
 136  
 137  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7