[ Index ] |
|
Code source de e107 0.7.8 |
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_news_menu.php,v $ 14 | $Revision: 1.18 $ 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_othernews")) 25 { 26 echo $cacheData; 27 return; 28 } 29 30 31 require_once(e_HANDLER."news_class.php"); 32 unset($text); 33 global $OTHERNEWS_STYLE; 34 $ix = new news; 35 36 if(!$OTHERNEWS_STYLE) 37 { 38 $OTHERNEWS_STYLE = " 39 <div style='padding:3px;width:100%'> 40 <table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'> 41 <tr> 42 <td style='vertical-align:top;padding:3px;width:20px'> 43 {NEWSCATICON} 44 </td><td style='text-align:left;padding:3px;vertical-align:top'> 45 {NEWSTITLELINK} 46 </td></tr></table> 47 </div>\n"; 48 } 49 50 51 if(!defined("OTHERNEWS_LIMIT")){ 52 define("OTHERNEWS_LIMIT",10); 53 } 54 55 if(!defined("OTHERNEWS_ITEMLINK")){ 56 define("OTHERNEWS_ITEMLINK",""); 57 } 58 59 if(!defined("OTHERNEWS_CATLINK")){ 60 define("OTHERNEWS_CATLINK",""); 61 } 62 if(!defined("OTHERNEWS_THUMB")){ 63 define("OTHERNEWS_THUMB","border:0px"); 64 } 65 if(!defined("OTHERNEWS_CATICON")){ 66 define("OTHERNEWS_CATICON","border:0px"); 67 } 68 69 if(!defined("OTHERNEWS_COLS")){ 70 define("OTHERNEWS_COLS","1"); 71 } 72 73 if(!defined("OTHERNEWS_CELL")){ 74 define("OTHERNEWS_CELL","padding:0px;vertical-align:top"); 75 } 76 77 if(!defined("OTHERNEWS_SPACING")){ 78 define("OTHERNEWS_SPACING","0"); 79 } 80 81 $param['itemlink'] = OTHERNEWS_ITEMLINK; 82 $param['thumbnail'] = OTHERNEWS_THUMB; 83 $param['catlink'] = OTHERNEWS_CATLINK; 84 $param['caticon'] = OTHERNEWS_CATICON; 85 86 $style = OTHERNEWS_CELL; 87 $nbr_cols = OTHERNEWS_COLS; 88 89 90 $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n 91 LEFT JOIN #user AS u ON n.news_author = u.user_id 92 LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id 93 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=2 ORDER BY n.news_datestamp DESC LIMIT 0,".OTHERNEWS_LIMIT; 94 95 if ($sql->db_Select_gen($query)){ 96 $text = "<table style='width:100%' cellpadding='0' cellspacing='".OTHERNEWS_SPACING."'>"; 97 $t = 0; 98 $wid = floor(100/$nbr_cols); 99 while ($row = $sql->db_Fetch()) { 100 $text .= ($t % $nbr_cols == 0) ? "<tr>" : ""; 101 $text .= "\n<td style='$style ; width:$wid%;'>\n"; 102 $text .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS_STYLE, $param); 103 104 $text .= "\n</td>\n"; 105 if (($t+1) % $nbr_cols == 0) { 106 $text .= "</tr>"; 107 $t++; 108 } 109 else { 110 $t++; 111 } 112 } 113 114 115 while ($t % $nbr_cols != 0){ 116 $text .= "<td style='width:$wid'> </td>\n"; 117 $text .= (($t+1) % nbr_cols == 0) ? "</tr>" : ""; 118 $t++; 119 120 } 121 $text .= "</table>"; 122 123 124 // Save Data 125 ob_start(); 126 127 $ns->tablerender(TD_MENU_L1, $text, 'other_news'); 128 129 $cache_data = ob_get_flush(); 130 $e107cache->set("nq_othernews", $cache_data); 131 } 132 133 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |