Bonjour à tous,

je dispose d'un forum phpbb3 + 1 site en php.
J'affiches des news sur l'index du site qui sont récupéré d'un topic du forum.


je souhaiterai disposer d'une pagination (ex: 3 news sur la index.php?page=01 puis ensuite 3 news suivante sur index.php?page=02.
et sur chaque news pourvoir ecrire un commentaire du site sur le topic du forum.

Merci à toutes les personnes qui pourront m'aider.


voici le code de index.php du site

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<?php
//Importe les fichiers nécessaires le fichier "common.php"
define('IN_PHPBB', true);  //Necessaire pour inclure common.php
$phpbb_root_path = './forum/';  //Défini le chemin d'accès
$phpEx  =  substr(strrchr(__FILE__,  '.'),  1);  //Récupère l'extension du fichier.
include($phpbb_root_path . 'common.' . $phpEx);  //Inclus le fichier.
include($phpbb_root_path . 'config.' . $phpEx);  //Inclus le fichier.
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
 
//session connection-->
if (isset($_GET['logout']))
{
   $user->session_kill();
   $user->session_begin();
}
if (isset($_POST['login']))
{
   $username = request_var('username', '', true);
   $password    = request_var('password', '', true);
   $autologin   = (!empty($_POST['autologin'])) ? true : false;
   $viewonline = (!empty($_POST['viewonline'])) ? 0 : 1;
   $admin = 0;
   $result = $auth->login($username, $password, $autologin, $viewonline, $admin);  
   if ($result['status'] != LOGIN_SUCCESS)
   {
      $err = $user->lang[$result['error_msg']];
      if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
      {
         $err = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>');
      }
   }
   else
   {
      $auth->acl($user->data);
   }
}
//session connection-->
//session news-->
    /* create_where_clauses( int[] gen_id, String type )
    * This function outputs an SQL WHERE statement for use when grabbing
    * posts and topics */
    function create_where_clauses($gen_id, $type)
    {
    global $db, $auth;
    $size_gen_id = sizeof($gen_id);
    switch($type)
    {
    case 'forum':
    $type = 'forum_id';
    break;
    case 'topic':
    $type = 'topic_id';
    break;
    default:
    trigger_error('No type defined');
    }
    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';
    if ($size_gen_id > 0)
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));
 
    if ($type == 'topic_id')
    {
    $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
    WHERE ' . $db->sql_in_set('topic_id', $gen_id) . '
    AND ' . $db->sql_in_set('forum_id', $auth_f_read);
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result))
    {
    // Create an array with all acceptable topic ids
    $topic_id_list[] = $row['topic_id'];
    }
    unset($gen_id);
    $gen_id = $topic_id_list;
    $size_gen_id = sizeof($gen_id);
    }
    $j = 0;
    for ($i = 0; $i < $size_gen_id; $i++)
     {
    $id_check = (int) $gen_id[$i]; // If the type is topic, all checks have been made and the query can start to be built if( $type == 'topic_id' ) { $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' '; } // If the type is forum, do the check to make sure the user has read permissions else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
    {
    $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
    }
    $j++;
    }
    }
    if ($out_where == '' && $size_gen_id > 0)
    {
    trigger_error('A list of topics/forums has not been created');
    }
    return $out_where;
    }	
    $search_limit = 3;
    $forum_id = array(53,0);
    $forum_id_where = create_where_clauses($forum_id, 'forum');
    $topic_id = array(47,0);
    $topic_id_where = create_where_clauses($topic_id, 'topic');
 
	//session news-->
	//session dernier message du forum-->
 
?>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>BRINK-FRANCE | Accueil</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="google-site-verification" content="EV3F6AQY6keRqbc8rNkbdBnkgvcjsYQ6n00dcCYA4-0" />
<meta http-equiv="content-language" content="fr" />
<meta name="keywords" content="Brink, jeu Brink, FPS, jeu en équipe, multijoueur" />
<meta name="description" content="Le site non-officiel de Brink, un nouveau jeu de tir immersif à la première personne, développé par Splash Damage et Bethesda Softworks. Sortie prévue au printemps 2011." />
<meta name="author" content="toxic" />
<meta name="revisit-after" content="20 Days" />
<meta name="robots" content="index,follow" />
<link rel="shortcut icon" href="http://www.wars-online.fr/img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="styleindex.css" media="screen" />
<link rel="stylesheet" type="text/css" href="script.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/tooltip.css" media="screen" />
<script type="text/javascript" src="js/jquery.tools.min.js"       </script>
<script type="text/javascript" src="js/jquery-1.3.2.js"           </script>
<script type="text/javascript" src="js/tools.tooltip-1.1.3.js"    </script>	
<script type="text/javascript" src="js/tools.expose-1.0.5.js"     </script>	
<script type="text/JavaScript">
<!--
 
 
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style></head>
<body id="top">
<div id="layout_wrapper">
<div id="layout_wrapper2" align="center"> 
<br />
<img src="img/header/head.png" width="1024" height="217"/>
<div id="layout_wrapper3">
<div id="layout_wrapper4">
<!--//start debut menu head page index//-->
<!--//start debut menu head page index//-->
<!--//start debut menu head page index//-->
		<div id="stylefour">
			<ul>
				<li class="current_page_item">
                <a href="http://www.wars-online.fr/forum/ucp.php?mode=register&sid=618e44014a099b4508a07bbbe0ba89b2">inscription</a></li>
				<li><a href="http://www.wars-online.fr/index.php">Home</a></li>
			    <li><a href="http://www.wars-online.fr/forum/index.php">Forum</a></li>
                <li><a href="http://www.wars-online.fr/dossier.php">Dossiers</a></li>
                <li><a href="http://www.wars-online.fr/forum/gallery/index.php">Galerie</a></li>
                <li><a href="http://www.wars-online.fr/forum/apropos.php">A propos</a></li>
				<li><a href="http://www.wars-online.fr/contact.php">Contact</a></li>				
			</ul>
	</div>
<div class="clearer">&nbsp;</div>
<?php include("fpss/fpss.php"); ?>
<div class="clearer">&nbsp;</div>
<!--//start debut content page index//-->	
<!--//start debut content page index//-->	
<!--//start debut content page index//-->
 
<div id="main_wrapper">
		<div id="main">
			<div class="left" id="content_wrapper">
				<div id="content">									
					<div class="post">
 
						<div class="post_title"><h2>Les news:</h2></div>
						<div class="post_date"></div>					
						<div class="post_body"></div>
						<div class="post_meta"><table width="100%" align="left"><?php include("php/news_block.php"); ?></table></div>
 
</div>	
</div>
</div>
 
 
 
<!--//start debut colonne droit page index//-->	
			<div class="right" id="sidebar_wrapper">
			  <div id="sidebar">			
<!--bloc inscription au forum-->
		  <div class="box">
          <div class="box_title Style1">Connectez-vous:</div>
		  <div class="box_content">
          <?php include("php/connect_block.php"); ?>
          </div>
			</div>								
<!--bloc inscription au forum-->
 
 
 
 
 
<!--bloc précommande-->
<div class="box">
  <div class="box_title">Précommander</div>
  <div class="box_content"> 
    <p><a href="http://store.steampowered.com/app/22350/"><img src="img/brink_160600d.jpg" width="160" height="600" longdesc="http://store.steampowered.com/app/22350/" /></a></p>
    </div>
</div>
 
<!--blocvideo-->
<div class="box">
  <div class="box_title">En direct de Steam</div>
  <div class="box_content"> 
    <p><img src="img/steam.png" width="200" height="67" /></p>
    <p align="left"><strong>Rejoignez le groupe BRINK france, et venez partager votre passion sur le multijoueur de BRINK avec de nombreux joueurs.</strong></p>
    <p>  <img src="img/buttons/grisleft.png" /><a href="http://steamcommunity.com/groups/brink_france" class="Style1"> Rejoindre notre groupe</a> </p>
  </div>
</div>
<!--bloc mumble-->
<!--bloc Partenaires-->
<div class="box">
  <div class="box_title">Partenaires</div>
  <div class="box_content">
    <a href="http://www.games-master.fr"><img src="http://www.wars-online.fr/partenaire/gm.png" alt="games-master" longdesc="http://www.games-master.fr" /></a> </div>
</div>
</div>
<!--bloc Partenaires-->
 
		</div>
	    </div>
		<div class="clearer">&nbsp;</div>
		</div>
	</div>	
	<!-- START footer -->
	<!-- START footer -->
	<!-- START footer -->
	<div id="dashboard_outer">
		<div id="dashboard">
 
 
<table width="1000" border="0">
  <tr width="600" border="0">
    <td width="61%">
 
    <div align="left">
	    <blockquote>
	      <p><img src="img/twitter_logo.png" align="absmiddle" /></p>
	      </blockquote>
   </div>
 
	  <script src="http://widgets.twimg.com/j/2/widget.js"></script>
 
	      <script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 5,
  interval: 6000,
  width: 580,
  height: 250,
  theme: {
    shell: {
      background: '#F2F2F2',
      color: '#050505'
    },
    tweets: {
      background: '#F2F2F2',
      color: '#0a0a0a',
      links: '#4aed05'
    }
  },
  features: {
    scrollbar: false,
    loop: false,
    live: false,
    hashtags: true,
    timestamp: true,
    avatars: true,
    behavior: 'all'
  }
}).render().setUser('BRINK_FRANCE').start();
            </script>	</td>
    <td width="39%" height="300">
     <div align="left">
     <blockquote>
       <p><img src="img/forum.png"  align="texttop" width="238" height="36" /></p>
     </blockquote>
     </div>
     <div align="left">
       <p><?php include("php/forum_block.php"); ?>
       <?php
while($row = $db->sql_fetchrow($result))
{
   $topic_id = $row['topic_id'];
   $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&amp;t=' . $topic_id);
   echo '<img src="img/buttons/widget-forum.png" />';
   echo '&nbsp;&nbsp;&nbsp;';
   echo '<a href="' . $view_topic_url . '">' . censor_text($row['topic_title']) . '</a><br />';
   echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
   echo '&nbsp;' . $user->lang['POSTED_ON_DATE'] . '&nbsp;' . $user->format_date($row['topic_time']).'<br />';
   $i++;
}
?>
 
 
       </p>
     </div>
 
 
     <p>&nbsp;</p>
     <p>&nbsp;</p>
     <p>&nbsp;</p>
     </td>
  </tr>
</table>
 
 
 
		</div>
	</div>
	<div id="footer">
		<div class="left"></div>
        <div class="center"><center>
Contact: webmaster @ brink-france.fr - © 2010 brink-france.fr - communauté française non officiel de Brink<br><a href="http://www.brinkthegame.com/" target="¨_blank">Brink</a> is a game by <a href="http://www.splashdamage.com/" target="¨_blank">Splash Damage</a> and <a href="http://www.bethsoft.com/" target="¨_blank">Bethesda Softworks</a>
</center>
 
 
		<div align="right">
 
                <div class="share">
            	<div class="share_ad"></div>
	            <div class="share_btns">
				<div id="bookmarker_70614">
 
					<a style="cursor: pointer; margin: 1px; display: inline-block;" onclick="document.location.href='http://digg.com/submit?partner=supportduweb&amp;url=[URL]&amp;title=[TITRE]'.replace('[TITRE]',
					titre_page_70614).replace('[URL]', url_page_70614);">
					<div style="width: 80px; height: 60px; background: url(&quot;http://www.wars-online.fr/img/social/share.png&quot;)
					repeat scroll 0px 0px transparent; display: inline-block; padding: 0px; margin: 0px;" onmouseover="this.style.backgroundPosition='-0px -60px';
					" onmouseout="this.style.backgroundPosition='-0px 0px';" alt="Digg"></div></a>
 
                    <a style="cursor: pointer; margin: 1px; display: inline-block;" onclick="document.location.href='http://delicious.com/post?partner=brinkfrance&amp;url=[URL]&amp;title=[TITRE]&amp;notes='.replace('[TITRE]',
					titre_page_70614).replace('[URL]', url_page_70614);">
                    <div style="width: 80px; height: 60px; background: url(&quot;http://www.wars-online.fr/img/social/share&quot;) 
					repeat scroll -80px 0px transparent; display: inline-block; padding: 0px; margin: 0px;" onmouseover="this.style.backgroundPosition=
					'-80px -60px';" onmouseout="this.style.backgroundPosition='-80px 0px';" alt="Delicious"></div></a>
 
					<a style="cursor: pointer; margin: 1px; display: inline-block;" onclick="document.location.href='http://www.facebook.com/share.php?u=[URL]'.replace('[TITRE]',
					titre_page_70614).replace('[URL]', url_page_70614);">
				    <div style="width: 80px; height: 60px; background: url(&quot;http://www.wars-online.fr/img/social/share.png&quot;) repeat scroll -160px 0px transparent;
					display: inline-block; padding: 0px; margin: 0px;" onmouseover="this.style.backgroundPosition='-160px -60px';" onmouseout="this.style.backgroundPosition='-160px 0px';" alt="Facebook"></div></a>
 
					<a style="cursor: pointer; margin: 1px; display: inline-block;" onclick="document.location.href='http://twitter.com/home?status=[URL]'.replace('[TITRE]', 
                    titre_page_70614).replace('[URL]', url_page_70614);">
					<div style="width: 80px; height: 60px; background: url(&quot;http://www.wars-online.fr/img/social/share.png&quot;)
					repeat scroll -240px 0px transparent; display: inline-block; padding: 0px; margin: 0px;" onmouseover="this.style.backgroundPosition='-240px -60px';" onmouseout="this.style.backgroundPosition='-240px 0px';
					" alt="Twitter"></div></a>
 
 
                    <a style="cursor: pointer; margin: 1px; display: inline-block;" onclick="document.location.href='http://www.google.com/bookmarks/mark?op=add&amp;bkmk=[URL]&amp;
					title=[TITRE]'.replace('[TITRE]', titre_page_70614).replace('[URL]', url_page_70614);">
					<div style="width: 80px; height: 60px; background: url(&quot;http://www.wars-online.fr/img/social/share.png&quot;)
					repeat scroll -320px 0px transparent; display: inline-block; padding: 0px; margin: 0px;" onmouseover="this.style.backgroundPosition='-320px -60px';
					" onmouseout="this.style.backgroundPosition='-320px 0px';" alt="Google Bookmarks"></div></a></div>					
					<script type="text/javascript" src="http://www.wars-online.fr/js/share.js"></script><br>
                </div>
                </div>
 
    </div>
	</div>
</div>
</div>
<!-- end footer -->
</div>
 
</body>
</html>
et voici news_bloc.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
 
    <?php
     $posts_ary = array(
        'SELECT'    => 'p.*, t.*',    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
 
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),  
 
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND t.topic_status <> ' . ITEM_MOVED . '
                        AND t.topic_approved = 1',   
        'ORDER_BY'  => 'p.post_id DESC',
    );   
    $posts = $db->sql_build_query('SELECT', $posts_ary);
    $posts_result = $db->sql_query_limit($posts, $search_limit);
 
      while( $posts_row = $db->sql_fetchrow($posts_result) )
      {
         $topic_title       = $posts_row['topic_title'];
         $topic_author       = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_colour']);
         $topic_date       = $user->format_date($posts_row['topic_time']);
         $topic_link       = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&amp;t=' . $posts_row['topic_id']);
         $post_text = nl2br($posts_row['post_text']);
         $bbcode = new bbcode(base64_encode($bbcode_bitfield));         
         $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);
         $post_text = smiley_text($post_text);
         $template->assign_block_vars('announcements', array(	 
         'TOPIC_TITLE'       => censor_text($topic_title),
         'TOPIC_AUTHOR'       => $topic_author,
         'TOPIC_DATE'       => $topic_date,
         'TOPIC_LINK'       => $topic_link,
         'POST_TEXT'         => censor_text($post_text),
         ));
 
  echo "<p align=\"left\"><img src=\"img/news.png\"/></p>";
  echo "<p align=\"left\"> <img src=\"img/buttons/widget-blog.png\" /><b>$topic_title</b>&nbsp;&nbsp;&nbsp;&nbsp;<b><img src=\"img/buttons/PostDateIcon.png\"/> Le $topic_date  <img src=\"img/buttons/PostAuthorIcon.png\" />  By $topic_author </b>
  <br /></p>";
  echo "<p align=\"left\"><br /><b>$post_text  </b> </p>";
  echo "<p align=\"left\"><br /><a href=\"http://www.wars-online.fr/$topic_link\"><img src=\"img/buttons/widget-comment.png\" /><strong>écrire un commentaire</strong></a></p>";
      }
    ?>