[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_files/shortcode/ -> news_categories.sc (source)

   1  global $sql,$pref,$tp,$NEWSCAT,$NEWSCAT_ITEM;
   2  require_once(e_HANDLER."news_class.php");
   3  $ix = new news;
   4  
   5  $nbr_cols = (isset($pref['nbr_cols'])) ? $pref['nbr_cols'] : 1;
   6  $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
   7  
   8      if(!defined("NEWSCAT_AMOUNT")){
   9          define("NEWSCAT_AMOUNT",3);
  10      }
  11  
  12      if(!$NEWSCAT){
  13          $NEWSCAT = "
  14              <div style='padding:5px'><div style='border-bottom:1px inset black; padding-bottom:1px;margin-bottom:5px'>
  15              {NEWSCATICON}&nbsp;{NEWSCATEGORY}
  16              </div>
  17              {NEWSCAT_ITEM}
  18              </div>
  19              ";
  20      }
  21  
  22      if(!$NEWSCAT_ITEM){
  23          $NEWSCAT_ITEM = "
  24          <div style='width:100%;padding-bottom:2px'>
  25          <table style='width:100%' cellpadding='0' cellspacing='0' border='0'>
  26          <tr>
  27          <td style='width:2px;vertical-align:top'>&#8226;
  28          </td>
  29          <td style='text-align:left;vertical-align:top;padding-left:3px'>
  30          {NEWSTITLELINK}
  31          <br />
  32          </td></tr>
  33          </table>
  34          </div>
  35          ";
  36      }
  37  
  38  
  39      if(!defined("NEWSCAT_CATLINK")){
  40              define("NEWSCAT_CATLINK","");
  41      }
  42      if(!defined("NEWSCAT_ITEMLINK")){
  43              define("NEWSCAT_ITEMLINK","");
  44      }
  45      if(!defined("NEWSCAT_STYLE")){
  46              define("NEWSCAT_STYLE","width:96%");
  47      }
  48      if(!defined("NEWSCAT_CATICON")){
  49              define("NEWSCAT_CATICON","border:0px");
  50      }
  51      if(!defined("NEWSCAT_THUMB")){
  52              define("NEWSCAT_THUMB","border:0px");
  53      }
  54  
  55      if(!defined("NEWSCAT_CELL")){
  56              define("NEWSCAT_CELL","vertical-align:top");
  57      }
  58  
  59  
  60  
  61      $param['itemlink'] = NEWSCAT_ITEMLINK;
  62      $param['thumbnail'] = NEWSCAT_THUMB;
  63      $param['catlink'] = NEWSCAT_CATLINK;
  64      $param['caticon'] = NEWSCAT_CATICON;
  65  
  66      $sql2 = new db;
  67      $sql2->db_Select("news_category", "*", "category_id!='' ORDER BY category_name ASC");
  68  
  69      $text3 = "\n\n\n
  70      <div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'>
  71      <table style='".NEWSCAT_STYLE."'  cellpadding='0' cellspacing='0'>
  72      \n";
  73      $t = 0;
  74              $wid = floor(100/$nbr_cols);
  75      while ($row3 = $sql2->db_Fetch()) {
  76          extract($row3);
  77  
  78          $search[0] = "/\{NEWSCATICON\}(.*?)/si";
  79          $replace[0] = ($category_icon) ? "<a href='".e_BASE."news.php?cat.".$category_id."'><img src='".e_IMAGE."icons/".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
  80  
  81          $search[1] = "/\{NEWSCATEGORY\}(.*?)/si";
  82          $replace[1] = ($category_name) ? "<a href='".e_BASE."news.php?cat.".$category_id."' style='".$param['catlink']."' >".$tp->toHTML($category_name,TRUE,"defs")."</a>" : "";
  83  
  84          $text3 .= ($t % $nbr_cols == 0) ? "<tr>" : "";
  85          $text3 .= "\n<td style='".NEWSCAT_CELL."; width:$wid%;'>\n";
  86  
  87  // Grab each news item.--------------
  88  
  89          $count = $sql->db_Select("news", "*", "news_category='".intval($category_id)."' AND news_class IN (".USERCLASS_LIST.") AND (news_start=0 || news_start < ".time().") AND (news_end=0 || news_end>".time().")  ORDER BY news_datestamp DESC LIMIT 0,".NEWSCAT_AMOUNT);
  90          while ($row = $sql->db_Fetch()) {
  91  
  92              $row['category_name'] = $category_name;
  93              $row['category_icon'] = $category_icon;
  94  
  95              $textbody .= $ix -> render_newsitem($row, 'return', '', $NEWSCAT_ITEM, $param);
  96  
  97          }
  98  // ----------------------------------
  99  
 100          $search[2] = "/\{NEWSCAT_ITEM\}(.*?)/si";
 101          $replace[2] = $textbody;
 102  
 103          $text3 .= preg_replace($search, $replace,$NEWSCAT);
 104          unset($textbody);
 105  
 106  
 107          $text3 .= "\n</td>\n";
 108          if (($t+1) % $nbr_cols == 0) {
 109              $text3 .= "</tr>";
 110              $t++;
 111          } else {
 112              $t++;
 113          }
 114      }
 115  
 116      while ($t % $nbr_cols != 0){
 117          $text3 .= "<td style='".NEWSCAT_CELL.";width:{$wid}%'>&nbsp;</td>\n";
 118          $text3 .= (($t+1) % nbr_cols == 0) ? "</tr>" : "";
 119          $t++;
 120      }
 121  
 122      $text3 .= "</table></div>";
 123  
 124  return $text3;


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