Maximum paginanummer weergave
op http://81.30.70.233/~dnp/ staan heel veel items, en zoals je ziet levert dat tot nu toe 32 pagina's op, en dat worden er steeds meer. Onhandig! Mooier zou zijn als je ziet
(1) | 2 | 3 | 4 | 5 >>
en mocht je al op pagina 4 geklikt hebben:
<< 2 | 3 | (4) | 5 | 6 >>
maar hoe?
alvast bedankt
hopelijk geeft het je een paar goeie ideeen,
EDIT:
$num is hier de huidige 'actieve' pagina
Code (php)
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
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
<?php
$max_numbers = 7;
$p = 1;
$i = 1;
while($num - $i > 0 && $i < ceil($max_numbers / 2)){
$p = $num - $i;
$i ++;
}
if(ceil($totaal / 5) < $p + $max_numbers - 1){
$eind = ceil($totaal / 5);
$p = $eind - (ceil($max_numbers / 2) + 2); // de ' + 2' moet aangepast worden indien $max_nummers veranderd word, (1 indien max_numbers 5 is bv)
if($eind < $p + $max_numbers - 2){
$p ++;
if($eind == $num)
$p --;
}
} else
$eind = $p + $max_numbers - 1;
while($p < 1)
$p ++;
$start = $p;
if($totaal < 1)
echo "niks gevonden";
else {
$eerste_pagina = ($num - 1) * $limiet;
$laatste_pagina = $num * $limiet;
if($laatste_pagina > $totaal)
$laatste_pagina = $totaal;
echo $eerste_pagina + 1, " t/m ", $laatste_pagina, " van de ", $totaal, " gevonden verkoopopdrachten");
}
while($p <= $eind){
if($p == $num)
echo $p;
else
echo '<a href="http://www.site.com/link_naar_de_pagina/' . $p . '">' . $p . '</a>';
if($p < $eind)
echo '| ';
$p ++;
}
?>
$max_numbers = 7;
$p = 1;
$i = 1;
while($num - $i > 0 && $i < ceil($max_numbers / 2)){
$p = $num - $i;
$i ++;
}
if(ceil($totaal / 5) < $p + $max_numbers - 1){
$eind = ceil($totaal / 5);
$p = $eind - (ceil($max_numbers / 2) + 2); // de ' + 2' moet aangepast worden indien $max_nummers veranderd word, (1 indien max_numbers 5 is bv)
if($eind < $p + $max_numbers - 2){
$p ++;
if($eind == $num)
$p --;
}
} else
$eind = $p + $max_numbers - 1;
while($p < 1)
$p ++;
$start = $p;
if($totaal < 1)
echo "niks gevonden";
else {
$eerste_pagina = ($num - 1) * $limiet;
$laatste_pagina = $num * $limiet;
if($laatste_pagina > $totaal)
$laatste_pagina = $totaal;
echo $eerste_pagina + 1, " t/m ", $laatste_pagina, " van de ", $totaal, " gevonden verkoopopdrachten");
}
while($p <= $eind){
if($p == $num)
echo $p;
else
echo '<a href="http://www.site.com/link_naar_de_pagina/' . $p . '">' . $p . '</a>';
if($p < $eind)
echo '| ';
$p ++;
}
?>
Gewijzigd op 25/06/2010 11:37:24 door Johan Dam
Code (php)
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
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
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Settings.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Make sure the menu length is an uneven number.
*/
#| Maximum length of the menu.
$menu_length = 5;
#| Menu's divider.
$menu_divider = ' | ';
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Page count.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier moet je je eigen code plaatsen voor het het berekenen van het aantal pagina's,
$page_count = 32;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Validate the supplied current page. " $_GET['page'] "
--------------------------------------------------------------------------------------------------------------------------*/
#| Current page.
$current_page = (isset($_GET['page']) and in_array($_GET['page'], range(1, $page_count))) ? $_GET['page'] : 1 ;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Menu's range.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Calculate the menu's range.
*/
#| Calculate the menu's middle point.
$mid_point = floor($menu_length / 2 );
#| Calculate the menu's range.
if($page_count < $menu_length){
#| Not enough pages for the fancy stuff.
$menu_range = range(1, $page_count);
}
elseif($current_page > ($page_count - $mid_point)){
#| Last couple of pages.
$menu_range = range(($page_count - $menu_length) , $page_count);
}
elseif($current_page > $mid_point){
#| Middle pages.
$menu_range = range(($current_page - $mid_point), ($current_page + $mid_point));
}
else{
#| First couple of pages.
$menu_range = range(1, $menu_length);
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pagination :: Demo</title>
</head>
<body>
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Video's weergeven.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier je while loop met video's.
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Previous page
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page > 1){
echo '<a href="?page='.($current_page - 1).'"><<</a> ';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Numeric menu.
--------------------------------------------------------------------------------------------------------------------------*/
#| Set " $menu " array for storing all the menu's items.
$menu = array();
#| Create all the menu's items.
foreach($menu_range as $page){
$menu[] = ($page == $current_page) ? '(<a href="?page='.$page.'">'.$page.'</a>) ' : '<a href="?page='.$page.'">'.$page.'</a>' ;
}
#| Display the menu.
echo implode($menu_divider, $menu);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Next page.
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page < $page_count){
echo ' <a href="?page='.($current_page + 1).'">>></a>';
}
?>
</body>
</html>
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Settings.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Make sure the menu length is an uneven number.
*/
#| Maximum length of the menu.
$menu_length = 5;
#| Menu's divider.
$menu_divider = ' | ';
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Page count.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier moet je je eigen code plaatsen voor het het berekenen van het aantal pagina's,
$page_count = 32;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Validate the supplied current page. " $_GET['page'] "
--------------------------------------------------------------------------------------------------------------------------*/
#| Current page.
$current_page = (isset($_GET['page']) and in_array($_GET['page'], range(1, $page_count))) ? $_GET['page'] : 1 ;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Menu's range.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Calculate the menu's range.
*/
#| Calculate the menu's middle point.
$mid_point = floor($menu_length / 2 );
#| Calculate the menu's range.
if($page_count < $menu_length){
#| Not enough pages for the fancy stuff.
$menu_range = range(1, $page_count);
}
elseif($current_page > ($page_count - $mid_point)){
#| Last couple of pages.
$menu_range = range(($page_count - $menu_length) , $page_count);
}
elseif($current_page > $mid_point){
#| Middle pages.
$menu_range = range(($current_page - $mid_point), ($current_page + $mid_point));
}
else{
#| First couple of pages.
$menu_range = range(1, $menu_length);
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pagination :: Demo</title>
</head>
<body>
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Video's weergeven.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier je while loop met video's.
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Previous page
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page > 1){
echo '<a href="?page='.($current_page - 1).'"><<</a> ';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Numeric menu.
--------------------------------------------------------------------------------------------------------------------------*/
#| Set " $menu " array for storing all the menu's items.
$menu = array();
#| Create all the menu's items.
foreach($menu_range as $page){
$menu[] = ($page == $current_page) ? '(<a href="?page='.$page.'">'.$page.'</a>) ' : '<a href="?page='.$page.'">'.$page.'</a>' ;
}
#| Display the menu.
echo implode($menu_divider, $menu);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Next page.
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page < $page_count){
echo ' <a href="?page='.($current_page + 1).'">>></a>';
}
?>
</body>
</html>
Gewijzigd op 25/06/2010 15:40:24 door - Mark -
Code (php)
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
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
<?php
# 10-10-2006
# pagina nummering v1.0
# G. de Rover
# GDRmedia
# [email protected]
//
// welke pagina er geshowed moet worden
$pag = $_GET['pag'];
// eerste bezoek moet 0 zijn.
if($pag == '1' || $pag == 1){
$pag = 0;
}
// het aantal resultaten per pagina.
$showRecords= 3;
//
// connectie settings
$myServer = 'localhost';
$myDataBase = 'xxx';
$myUser = 'xxxx';
$myPass = 'xxxx';
//
$myConn = mysql_connect($myServer, $myUser, $myPass);
$select = mysql_select_db($myDataBase, $myConn);
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC';
$results = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($results);
//
$pages = $num_rows / $showRecords;
//
if($pages>1){
$myPage = $pag * $showRecords;
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC LIMIT '.$myPage.', '.$showRecords;
$results = mysql_query($query) or die(mysql_error());
}
//output:
echo '<div class="divpaginatelling">';
// checkt of er uberhaubt wel meerdere pagina's zijn.
if($pages > 1){
for($i=1; $i<=floor($pages); $i++){
echo ' | <a href='.$_SERVER['PHP_SELF'].'?pag='.$i.'>'.$i.'</a>';
}
echo ' |<br/></div><br/>';
}
// spuug de gewenste data uit.
while ($row = mysql_fetch_array($results)) {
echo ' <div class="geheel">
<div class="linkerkolom">
<div class="bovenlinks">
<div class="titel"><div class="id">( '.$row['ID'].' ) </div> '.$row['Titel'].'</div>
<div class="datum">'.$row['Datum'].'</div>
</div><br>
<div class="onderlinks">
<div class="bericht"><br><b>'.$row['Plaats'].'</b> - '.$row['Bericht'];
ETC....
[/code]
# 10-10-2006
# pagina nummering v1.0
# G. de Rover
# GDRmedia
# [email protected]
//
// welke pagina er geshowed moet worden
$pag = $_GET['pag'];
// eerste bezoek moet 0 zijn.
if($pag == '1' || $pag == 1){
$pag = 0;
}
// het aantal resultaten per pagina.
$showRecords= 3;
//
// connectie settings
$myServer = 'localhost';
$myDataBase = 'xxx';
$myUser = 'xxxx';
$myPass = 'xxxx';
//
$myConn = mysql_connect($myServer, $myUser, $myPass);
$select = mysql_select_db($myDataBase, $myConn);
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC';
$results = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($results);
//
$pages = $num_rows / $showRecords;
//
if($pages>1){
$myPage = $pag * $showRecords;
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC LIMIT '.$myPage.', '.$showRecords;
$results = mysql_query($query) or die(mysql_error());
}
//output:
echo '<div class="divpaginatelling">';
// checkt of er uberhaubt wel meerdere pagina's zijn.
if($pages > 1){
for($i=1; $i<=floor($pages); $i++){
echo ' | <a href='.$_SERVER['PHP_SELF'].'?pag='.$i.'>'.$i.'</a>';
}
echo ' |<br/></div><br/>';
}
// spuug de gewenste data uit.
while ($row = mysql_fetch_array($results)) {
echo ' <div class="geheel">
<div class="linkerkolom">
<div class="bovenlinks">
<div class="titel"><div class="id">( '.$row['ID'].' ) </div> '.$row['Titel'].'</div>
<div class="datum">'.$row['Datum'].'</div>
</div><br>
<div class="onderlinks">
<div class="bericht"><br><b>'.$row['Plaats'].'</b> - '.$row['Bericht'];
ETC....
[/code]
Gewijzigd op 25/06/2010 13:08:23 door Johan Sebastiaan
Als ik op http://81.30.70.233/~dnp/ kijk heb je het MySQL gedeelte al. Ik heb het commentaar iets aangepast, je kunt mijn code gewoon als een nieuwe pagina opslaan en bekijken voor de werking, je moet het iets uit elkaar halen en in jouw website bouwen. maar zo onduidelijk kan het toch niet zijn?
Nou eerlijk gezegd raak ik helemaal in de war van alle codes. Of ik krijg een error of ik krijg helemaal niks van die code te zien...
Errors altijd even posten. Eventueel met enkele relevante coderegels.
Warning: Division by zero in /home/dnp/domains/dnp.nu/public_html/tester.php on line 193
en bovendien pakt ie de ID niet, want de mappen worden ook niet correct uitgelezen (de mapnamen zijn gelijk aan de idnamen. Toch leest hij wel 32 pagina's, wat precies klopt met het orginele script...
http://81.30.70.233/~dnp/tester.php
Code (php)
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
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
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Settings.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Make sure the menu length is an uneven number.
*/
#| Maximum length of the menu.
$menu_length = 5;
#| Menu's divider.
$menu_divider = ' | ';
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Page count.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier moet je je eigen code plaatsen voor het het berekenen van het aantal pagina's,
$page_count = 32;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Validate the supplied current page. " $_GET['page'] "
--------------------------------------------------------------------------------------------------------------------------*/
#| Current page.
$current_page = (isset($_GET['page']) and in_array($_GET['page'], range(1, $page_count))) ? $_GET['page'] : 1 ;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Menu's range.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Calculate the menu's range.
*/
#| Calculate the menu's middle point.
$mid_point = floor($menu_length / 2 );
#| Calculate the menu's range.
if($page_count < $menu_length){
#| Not enough pages for the fancy stuff.
$menu_range = range(1, $page_count);
}
elseif($current_page > ($page_count - $mid_point)){
#| Last couple of pages.
$menu_range = range(($page_count - $menu_length) , $page_count);
}
elseif($current_page > $mid_point){
#| Middle pages.
$menu_range = range(($current_page - $mid_point), ($current_page + $mid_point));
}
else{
#| First couple of pages.
$menu_range = range(1, $menu_length);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> DNP.NU beta 3</title>
<LINK REL=StyleSheet HREF="style1.css" TYPE="text/css" MEDIA=screen>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<SCRIPT>
<!-- PopUp Link JavaScript Code Provided By: http://www.DesignerWiz.com - Development Resource & JavaScript Public Archive Center -->
function popUp(page,PWidth,PHeight,id) {
eval("designerwiz"+id+"=window.open('"+page+"','designerwiz1','toolbar=0,scrollbars=1,location=0,status=1,menubars=0,resizable=0,width="+PWidth+",height="+PHeight+"')")
eval;("wiz"+id+".window.moveTo((screen.width/2)-(PWidth/2),(screen.height/2)-(PHeight/2))")
}
</SCRIPT>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
</head>
<body>
<div class="container">
<div class="midden2">
<div class="midden">
<div class="header">
<img src="layout/img/header.png" alt="DNP.NU">
</div>
<div class="divmenu">
<A HREF="javascript:popUp('upload.php',500,250,1);"><img src="layout/img/uploadbutton.png" border=0 alt="Upload jouw video op DNP.NU" align="right"></a>
</div>
<body>
<?php
// connectie settings
$myServer = 'localhost';
$myDataBase = 'xxx';
$myUser = 'xxx';
$myPass = 'xxx';
//
$myConn = mysql_connect($myServer, $myUser, $myPass);
$select = mysql_select_db($myDataBase, $myConn);
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC';
$results = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($results);
//
/*--------------------------------------------------------------------------------------------------------------------------
(§) Video's weergeven.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier je while loop met video's.
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Previous page
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page > 1){
echo '<a href="?page='.($current_page - 1).'"><<</a> ';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Numeric menu.
--------------------------------------------------------------------------------------------------------------------------*/
#| Set " $menu " array for storing all the menu's items.
$menu = array();
#| Create all the menu's items.
foreach($menu_range as $page){
$menu[] = ($page == $current_page) ? '(<a href="?page='.$page.'">'.$page.'</a>) ' : '<a href="?page='.$page.'">'.$page.'</a>' ;
}
#| Display the menu.
echo implode($menu_divider, $menu);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Next page.
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page < $page_count){
echo ' <a href="?page='.($current_page + 1).'">>></a>';
}
$pages = $num_rows / $showRecords;
//
if($pages>1){
$myPage = $pag * $showRecords;
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC LIMIT '.$myPage.', '.$showRecords;
$results = mysql_query($query) or die(mysql_error());
}
echo ' <div class="geheel">
<div class="linkerkolom">
<div class="bovenlinks">
<div class="titel"><div class="id">( '.$row['ID'].' ) </div> '.$row['Titel'].'</div>
<div class="datum">'.$row['Datum'].'</div>
</div><br>
<div class="onderlinks">
<div class="bericht"><br><b>'.$row['Plaats'].'</b> - '.$row['Bericht'];
$dirname = "dnpnieuw/items/".$row['ID']."/downloads";
$images = scandir($dirname);
$ignore = Array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<br><a href="dnpnieuw/items/'.$row['ID'].'/downloads/'.$curimg.'">Download '.$curimg.'</a><br>'.PHP_EOL;
}
}
echo '</div>
</div>
</div>
<div class="rechterkolom"><img src="layout/img/balkvideo.png" alt="Bekijk onderstaande video">';
$dirname = "dnpnieuw/items/".$row['ID']."/flv/";
$images = scandir($dirname);
$ignore = Array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0
width=381 height=216 id=fullscreen align=middle>
<param name="WMode" value="transparent"></param>
<param name=allowScriptAccess value=sameDomain/>
<param name=movie value="flvplayer.swf/>
<param name=quality value=high />
<param name=salign value=tl />
<param name=bgcolor value=#ffffff />
<param name="startimage" value="start_frame.jpg" />
<param name="autoplay" value="0" />
<param name="autoload" value="0" />
<param name="buffer" value="5" />
<param name="buffermessage" value="" />
<param name="buffercolor" value="ffffff" />
<param name="bufferbgcolor" value="858686" />
<param name="buffershowbg" value="0" />
<param name="title" value="20100214 Zwaag carnaval" />
<param name="titlesize" value="20" />
<param name="titlecolor" value="ffffff" />
<param name="margin" value="0" />
<param name="srt" value="0" />
<param name="srtcolor" value="ffffff" />
<param name="srtbgcolor" value="858686" />
<param name="srtsize" value="11" />
<param name="showstop" value="1" />
<param name="showvolume" value="1" />
<param name="showtime" value="1" />
<param name="showplayer" value="autohide" />
<param name="showloading" value="autohide" />
<param name="showfullscreen" value="1" />
<param name="showswitchsubtitles" value="0" />
<param name="showmouse" value="autohide" />
<param name="loop" value="0" />
<param name="startimage" value="start_frame.jpg" />
<param name="playercolor" value="858686" />
<param name="loadingcolor" value="dddddd" />
<param name="bgcolor" value="ffffff" />
<param name="bgcolor1" value="ffffff" />
<param name="bgcolor2" value="ffffff" />
<param name="buttoncolor" value="ffffff" />
<param name="buttonovercolor" value="c3c4c4" />
<param name="slidercolor1" value="ffffff" />
<param name="slidercolor2" value="cccccc" />
<param name="sliderovercolor" value="c3c4c4" />
<param name="loadonstop" value="0" />
<param name="onclick" value="playpause" />
<param name="onclicktarget" value="_blank" />
<param name="ondoubleclick" value="fullscreen" />
<param name="ondoubleclicktarget" value="_blank" />
<param name="playertimeout" value="1500" />
<param name="videobgcolor" value="000000" />
<param name="volume" value="100" />
<param name="shortcut" value="1" />
<param name="playeralpha" value="100" />
<param name="srturl" value="video.srt" />
<param name="top1" value="0" />
<param name="showiconplay" value="1" />
<param name="iconplaycolor" value="ffffff" />
<param name="iconplaybgcolor" value="dddddd" />
<param name="iconplaybgalpha" value="25" />
<param name="showtitleandstartimage" value="0" />
<param NAME=FlashVars VALUE="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'">
<embed wmode="transparent" src=flvplayer.swf FlashVars="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'" quality=high
salign=tl bgcolor=#ffffff width=381 height=216 name=fullscreen
align=middle allowScriptAccess=sameDomain type=application/x-shockwave-
flash pluginspage=http://www.macromedia.com/go/getflashplayer/>
</object>'.PHP_EOL;
}
}
echo '
<br>
<img src="layout/img/balkfoto.png" alt="Bekijk onderstaande video">
<div class="fotoalbum"><div class="fotoalbumcenter">';
$dirname = "dnpnieuw/items/".$row['ID']."/foto/";
$images = scandir($dirname);
$ignore = Array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<a href="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" rel="lightbox['.$row['ID'].']"><img img width=109 border=0 height=61 Hspace=5 Vspace=5 src="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" alt="Foto: DNP.NU"></a>';
}
}
echo '
</div></div>
</div>
</div><br>
';
?>
</div>
</body>
</html>
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Settings.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Make sure the menu length is an uneven number.
*/
#| Maximum length of the menu.
$menu_length = 5;
#| Menu's divider.
$menu_divider = ' | ';
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Page count.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier moet je je eigen code plaatsen voor het het berekenen van het aantal pagina's,
$page_count = 32;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Validate the supplied current page. " $_GET['page'] "
--------------------------------------------------------------------------------------------------------------------------*/
#| Current page.
$current_page = (isset($_GET['page']) and in_array($_GET['page'], range(1, $page_count))) ? $_GET['page'] : 1 ;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Menu's range.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Calculate the menu's range.
*/
#| Calculate the menu's middle point.
$mid_point = floor($menu_length / 2 );
#| Calculate the menu's range.
if($page_count < $menu_length){
#| Not enough pages for the fancy stuff.
$menu_range = range(1, $page_count);
}
elseif($current_page > ($page_count - $mid_point)){
#| Last couple of pages.
$menu_range = range(($page_count - $menu_length) , $page_count);
}
elseif($current_page > $mid_point){
#| Middle pages.
$menu_range = range(($current_page - $mid_point), ($current_page + $mid_point));
}
else{
#| First couple of pages.
$menu_range = range(1, $menu_length);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> DNP.NU beta 3</title>
<LINK REL=StyleSheet HREF="style1.css" TYPE="text/css" MEDIA=screen>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<SCRIPT>
<!-- PopUp Link JavaScript Code Provided By: http://www.DesignerWiz.com - Development Resource & JavaScript Public Archive Center -->
function popUp(page,PWidth,PHeight,id) {
eval("designerwiz"+id+"=window.open('"+page+"','designerwiz1','toolbar=0,scrollbars=1,location=0,status=1,menubars=0,resizable=0,width="+PWidth+",height="+PHeight+"')")
eval;("wiz"+id+".window.moveTo((screen.width/2)-(PWidth/2),(screen.height/2)-(PHeight/2))")
}
</SCRIPT>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
</head>
<body>
<div class="container">
<div class="midden2">
<div class="midden">
<div class="header">
<img src="layout/img/header.png" alt="DNP.NU">
</div>
<div class="divmenu">
<A HREF="javascript:popUp('upload.php',500,250,1);"><img src="layout/img/uploadbutton.png" border=0 alt="Upload jouw video op DNP.NU" align="right"></a>
</div>
<body>
<?php
// connectie settings
$myServer = 'localhost';
$myDataBase = 'xxx';
$myUser = 'xxx';
$myPass = 'xxx';
//
$myConn = mysql_connect($myServer, $myUser, $myPass);
$select = mysql_select_db($myDataBase, $myConn);
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC';
$results = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($results);
//
/*--------------------------------------------------------------------------------------------------------------------------
(§) Video's weergeven.
--------------------------------------------------------------------------------------------------------------------------*/
// Hier je while loop met video's.
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Previous page
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page > 1){
echo '<a href="?page='.($current_page - 1).'"><<</a> ';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Numeric menu.
--------------------------------------------------------------------------------------------------------------------------*/
#| Set " $menu " array for storing all the menu's items.
$menu = array();
#| Create all the menu's items.
foreach($menu_range as $page){
$menu[] = ($page == $current_page) ? '(<a href="?page='.$page.'">'.$page.'</a>) ' : '<a href="?page='.$page.'">'.$page.'</a>' ;
}
#| Display the menu.
echo implode($menu_divider, $menu);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Next page.
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page < $page_count){
echo ' <a href="?page='.($current_page + 1).'">>></a>';
}
$pages = $num_rows / $showRecords;
//
if($pages>1){
$myPage = $pag * $showRecords;
//
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC LIMIT '.$myPage.', '.$showRecords;
$results = mysql_query($query) or die(mysql_error());
}
echo ' <div class="geheel">
<div class="linkerkolom">
<div class="bovenlinks">
<div class="titel"><div class="id">( '.$row['ID'].' ) </div> '.$row['Titel'].'</div>
<div class="datum">'.$row['Datum'].'</div>
</div><br>
<div class="onderlinks">
<div class="bericht"><br><b>'.$row['Plaats'].'</b> - '.$row['Bericht'];
$dirname = "dnpnieuw/items/".$row['ID']."/downloads";
$images = scandir($dirname);
$ignore = Array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<br><a href="dnpnieuw/items/'.$row['ID'].'/downloads/'.$curimg.'">Download '.$curimg.'</a><br>'.PHP_EOL;
}
}
echo '</div>
</div>
</div>
<div class="rechterkolom"><img src="layout/img/balkvideo.png" alt="Bekijk onderstaande video">';
$dirname = "dnpnieuw/items/".$row['ID']."/flv/";
$images = scandir($dirname);
$ignore = Array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0
width=381 height=216 id=fullscreen align=middle>
<param name="WMode" value="transparent"></param>
<param name=allowScriptAccess value=sameDomain/>
<param name=movie value="flvplayer.swf/>
<param name=quality value=high />
<param name=salign value=tl />
<param name=bgcolor value=#ffffff />
<param name="startimage" value="start_frame.jpg" />
<param name="autoplay" value="0" />
<param name="autoload" value="0" />
<param name="buffer" value="5" />
<param name="buffermessage" value="" />
<param name="buffercolor" value="ffffff" />
<param name="bufferbgcolor" value="858686" />
<param name="buffershowbg" value="0" />
<param name="title" value="20100214 Zwaag carnaval" />
<param name="titlesize" value="20" />
<param name="titlecolor" value="ffffff" />
<param name="margin" value="0" />
<param name="srt" value="0" />
<param name="srtcolor" value="ffffff" />
<param name="srtbgcolor" value="858686" />
<param name="srtsize" value="11" />
<param name="showstop" value="1" />
<param name="showvolume" value="1" />
<param name="showtime" value="1" />
<param name="showplayer" value="autohide" />
<param name="showloading" value="autohide" />
<param name="showfullscreen" value="1" />
<param name="showswitchsubtitles" value="0" />
<param name="showmouse" value="autohide" />
<param name="loop" value="0" />
<param name="startimage" value="start_frame.jpg" />
<param name="playercolor" value="858686" />
<param name="loadingcolor" value="dddddd" />
<param name="bgcolor" value="ffffff" />
<param name="bgcolor1" value="ffffff" />
<param name="bgcolor2" value="ffffff" />
<param name="buttoncolor" value="ffffff" />
<param name="buttonovercolor" value="c3c4c4" />
<param name="slidercolor1" value="ffffff" />
<param name="slidercolor2" value="cccccc" />
<param name="sliderovercolor" value="c3c4c4" />
<param name="loadonstop" value="0" />
<param name="onclick" value="playpause" />
<param name="onclicktarget" value="_blank" />
<param name="ondoubleclick" value="fullscreen" />
<param name="ondoubleclicktarget" value="_blank" />
<param name="playertimeout" value="1500" />
<param name="videobgcolor" value="000000" />
<param name="volume" value="100" />
<param name="shortcut" value="1" />
<param name="playeralpha" value="100" />
<param name="srturl" value="video.srt" />
<param name="top1" value="0" />
<param name="showiconplay" value="1" />
<param name="iconplaycolor" value="ffffff" />
<param name="iconplaybgcolor" value="dddddd" />
<param name="iconplaybgalpha" value="25" />
<param name="showtitleandstartimage" value="0" />
<param NAME=FlashVars VALUE="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'">
<embed wmode="transparent" src=flvplayer.swf FlashVars="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'" quality=high
salign=tl bgcolor=#ffffff width=381 height=216 name=fullscreen
align=middle allowScriptAccess=sameDomain type=application/x-shockwave-
flash pluginspage=http://www.macromedia.com/go/getflashplayer/>
</object>'.PHP_EOL;
}
}
echo '
<br>
<img src="layout/img/balkfoto.png" alt="Bekijk onderstaande video">
<div class="fotoalbum"><div class="fotoalbumcenter">';
$dirname = "dnpnieuw/items/".$row['ID']."/foto/";
$images = scandir($dirname);
$ignore = Array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<a href="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" rel="lightbox['.$row['ID'].']"><img img width=109 border=0 height=61 Hspace=5 Vspace=5 src="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" alt="Foto: DNP.NU"></a>';
}
}
echo '
</div></div>
</div>
</div><br>
';
?>
</div>
</body>
</html>
Gewijzigd op 29/06/2010 15:20:35 door Johan Sebastiaan
Je kan niet door 0 (nul) delen.
$pages = $num_rows / $showRecords;
als een 0?
Deze is nul: $showRecords
enn.. hoe los ik het op? ligt daar ook het probleem dat hij de tabel niet goed uitleest (en daardoor de mappen)?
Je geeft $showRecords nergens een waarde.
Heb nu gezegd $showRecords = 1. Gevolg is dat de foutmelding weg is, maar volgens mij doe k het niet goed, want er worden nog steeds geen gegevens uit de tabel uitgelezen...
Ik heb net even gekeken naar je huidige code, Er zit wel meer dan 1 fout in ben ik bang. Je bent ook nog een paar dingen vergeten / en er zitten een paar stukken code op de verkeerde plaats. Je ziet niks omdat je de resultaten wel ophaalt maar niet weergeeft " Je mist een while loop ". Als ik tijd heb kijk ik er vanavond misschien even naar.
Dat zou top zijn! thnx voor de snelle scan alvast in iedergeval.
Je hebt heel veel verschillende scripts door elkaar gegooid gok zo te zien. Je sloot ook verschillende div's niet goed af.
Let ook even op de volgorde van je code de volgende keer, Het aantal pagina's was veel eerder nodig dan jij ze berekende.
Anway hopelijk lukt het.
Code (php)
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
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
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Settings | MySQL database connection.
--------------------------------------------------------------------------------------------------------------------------*/
#| Database info.
$myServer = 'localhost';
$myDataBase = 'xxx';
$myUser = 'xxx';
$myPass = 'xxx';
/*--------------------------------------------------------------------------------------------------------------------------
(§) MySQL | Database connection.
--------------------------------------------------------------------------------------------------------------------------*/
$myConn = mysql_connect($myServer, $myUser, $myPass);
$select = mysql_select_db($myDataBase, $myConn);
// LET OP! Foutafhandeling inbouwen.
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Settings.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Make sure the menu length is an uneven number.
*/
#| Results per page.
$results_per_page = 10;
#| Maximum length of the menu.
$menu_length = 5;
#| Menu's divider.
$menu_divider = ' | ';
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Page count.
--------------------------------------------------------------------------------------------------------------------------*/
#| Totaal aantal resultaten tellen.
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC';
$results = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($results);
// LET OP! Foutafhandeling inbouwen.
#| Aantal pagina's berekenen.
$page_count = ceil($num_rows / $results_per_page);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Validate the supplied current page. " $_GET['page'] "
--------------------------------------------------------------------------------------------------------------------------*/
#| Current page.
$current_page = (isset($_GET['page']) and in_array($_GET['page'], range(1, $page_count))) ? $_GET['page'] : 1 ;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Menu's range.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Calculate the menu's range.
*/
#| Calculate the menu's middle point.
$mid_point = floor($menu_length / 2 );
#| Calculate the menu's range.
if($page_count < $menu_length){
#| Not enough pages for the fancy stuff.
$menu_range = range(1, $page_count);
}
elseif($current_page > ($page_count - $mid_point)){
#| Last couple of pages.
$menu_range = range(($page_count - $menu_length) , $page_count);
}
elseif($current_page > $mid_point){
#| Middle pages.
$menu_range = range(($current_page - $mid_point), ($current_page + $mid_point));
}
else{
#| First couple of pages.
$menu_range = range(1, $menu_length);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> DNP.NU beta 3</title>
<LINK REL=StyleSheet HREF="style1.css" TYPE="text/css" MEDIA=screen>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<SCRIPT>
<!-- PopUp Link JavaScript Code Provided By: http://www.DesignerWiz.com - Development Resource & JavaScript Public Archive Center -->
function popUp(page,PWidth,PHeight,id) {
eval("designerwiz"+id+"=window.open('"+page+"','designerwiz1','toolbar=0,scrollbars=1,location=0,status=1,menubars=0,resizable=0,width="+PWidth+",height="+PHeight+"')")
eval;("wiz"+id+".window.moveTo((screen.width/2)-(PWidth/2),(screen.height/2)-(PHeight/2))")
}
</SCRIPT>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
</head>
<body>
<div class="container">
<div class="midden2">
<div class="midden">
<div class="header">
<img src="layout/img/header.png" alt="DNP.NU">
</div>
<div class="divmenu">
<A HREF="javascript:popUp('upload.php',500,250,1);"><img src="layout/img/uploadbutton.png" border=0 alt="Upload jouw video op DNP.NU" align="right"></a>
</div>
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Previous page
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page > 1){
echo '<a href="?page='.($current_page - 1).'"><<</a> ';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Numeric menu.
--------------------------------------------------------------------------------------------------------------------------*/
#| Set " $menu " array for storing all the menu's items.
$menu = array();
#| Create all the menu's items.
foreach($menu_range as $page){
$menu[] = ($page == $current_page) ? '(<a href="?page='.$page.'">'.$page.'</a>) ' : '<a href="?page='.$page.'">'.$page.'</a>' ;
}
#| Display the menu.
echo implode($menu_divider, $menu);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Next page.
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page < $page_count){
echo ' <a href="?page='.($current_page + 1).'">>></a>';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Alle resultaten ophalen en weergeven.
--------------------------------------------------------------------------------------------------------------------------*/
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC LIMIT '.mysql_real_escape_string((($current_page - 1) * $results_per_page)).', '.$results_per_page;
$results = mysql_query($query) or die(mysql_error());
// LET OP! Foutafhandeling inbouwen.
while($row = mysql_fetch_assoc($results)){
echo ' <div class="geheel">
<div class="linkerkolom">
<div class="bovenlinks">
<div class="titel"><div class="id">( '.$row['ID'].' ) </div> '.$row['Titel'].'</div>
<div class="datum">'.$row['Datum'].'</div>
</div><br>
<div class="onderlinks">
<div class="bericht"><br><b>'.$row['Plaats'].'</b> - '.$row['Bericht'];
$dirname = "dnpnieuw/items/".$row['ID']."/downloads";
$images = scandir($dirname);
$ignore = array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<br><a href="dnpnieuw/items/'.$row['ID'].'/downloads/'.$curimg.'">Download '.$curimg.'</a><br>';
}
}
echo '</div>
</div>
</div>
<div class="rechterkolom"><img src="layout/img/balkvideo.png" alt="Bekijk onderstaande video">';
$dirname = "dnpnieuw/items/".$row['ID']."/flv/";
$images = scandir($dirname);
$ignore = array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0
width=381 height=216 id=fullscreen align=middle>
<param name="WMode" value="transparent"></param>
<param name=allowScriptAccess value=sameDomain/>
<param name=movie value="flvplayer.swf/>
<param name=quality value=high />
<param name=salign value=tl />
<param name=bgcolor value=#ffffff />
<param name="startimage" value="start_frame.jpg" />
<param name="autoplay" value="0" />
<param name="autoload" value="0" />
<param name="buffer" value="5" />
<param name="buffermessage" value="" />
<param name="buffercolor" value="ffffff" />
<param name="bufferbgcolor" value="858686" />
<param name="buffershowbg" value="0" />
<param name="title" value="20100214 Zwaag carnaval" />
<param name="titlesize" value="20" />
<param name="titlecolor" value="ffffff" />
<param name="margin" value="0" />
<param name="srt" value="0" />
<param name="srtcolor" value="ffffff" />
<param name="srtbgcolor" value="858686" />
<param name="srtsize" value="11" />
<param name="showstop" value="1" />
<param name="showvolume" value="1" />
<param name="showtime" value="1" />
<param name="showplayer" value="autohide" />
<param name="showloading" value="autohide" />
<param name="showfullscreen" value="1" />
<param name="showswitchsubtitles" value="0" />
<param name="showmouse" value="autohide" />
<param name="loop" value="0" />
<param name="startimage" value="start_frame.jpg" />
<param name="playercolor" value="858686" />
<param name="loadingcolor" value="dddddd" />
<param name="bgcolor" value="ffffff" />
<param name="bgcolor1" value="ffffff" />
<param name="bgcolor2" value="ffffff" />
<param name="buttoncolor" value="ffffff" />
<param name="buttonovercolor" value="c3c4c4" />
<param name="slidercolor1" value="ffffff" />
<param name="slidercolor2" value="cccccc" />
<param name="sliderovercolor" value="c3c4c4" />
<param name="loadonstop" value="0" />
<param name="onclick" value="playpause" />
<param name="onclicktarget" value="_blank" />
<param name="ondoubleclick" value="fullscreen" />
<param name="ondoubleclicktarget" value="_blank" />
<param name="playertimeout" value="1500" />
<param name="videobgcolor" value="000000" />
<param name="volume" value="100" />
<param name="shortcut" value="1" />
<param name="playeralpha" value="100" />
<param name="srturl" value="video.srt" />
<param name="top1" value="0" />
<param name="showiconplay" value="1" />
<param name="iconplaycolor" value="ffffff" />
<param name="iconplaybgcolor" value="dddddd" />
<param name="iconplaybgalpha" value="25" />
<param name="showtitleandstartimage" value="0" />
<param NAME=FlashVars VALUE="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'">
<embed wmode="transparent" src=flvplayer.swf FlashVars="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'" quality=high
salign=tl bgcolor=#ffffff width=381 height=216 name=fullscreen
align=middle allowScriptAccess=sameDomain type=application/x-shockwave-
flash pluginspage=http://www.macromedia.com/go/getflashplayer/>
</object>';
}
}
echo '
<br>
<img src="layout/img/balkfoto.png" alt="Bekijk onderstaande video">
<div class="fotoalbum"><div class="fotoalbumcenter">';
$dirname = "dnpnieuw/items/".$row['ID']."/foto/";
$images = scandir($dirname);
$ignore = array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<a href="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" rel="lightbox['.$row['ID'].']"><img img width=109 border=0 height=61 Hspace=5 Vspace=5 src="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" alt="Foto: DNP.NU"></a>';
}
}
echo '
</div></div>
';
} // End of while loop.
?>
</div></div><br /></div>
</body>
</html>
/*--------------------------------------------------------------------------------------------------------------------------
(§) Settings | MySQL database connection.
--------------------------------------------------------------------------------------------------------------------------*/
#| Database info.
$myServer = 'localhost';
$myDataBase = 'xxx';
$myUser = 'xxx';
$myPass = 'xxx';
/*--------------------------------------------------------------------------------------------------------------------------
(§) MySQL | Database connection.
--------------------------------------------------------------------------------------------------------------------------*/
$myConn = mysql_connect($myServer, $myUser, $myPass);
$select = mysql_select_db($myDataBase, $myConn);
// LET OP! Foutafhandeling inbouwen.
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Settings.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Make sure the menu length is an uneven number.
*/
#| Results per page.
$results_per_page = 10;
#| Maximum length of the menu.
$menu_length = 5;
#| Menu's divider.
$menu_divider = ' | ';
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Page count.
--------------------------------------------------------------------------------------------------------------------------*/
#| Totaal aantal resultaten tellen.
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC';
$results = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($results);
// LET OP! Foutafhandeling inbouwen.
#| Aantal pagina's berekenen.
$page_count = ceil($num_rows / $results_per_page);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Validate the supplied current page. " $_GET['page'] "
--------------------------------------------------------------------------------------------------------------------------*/
#| Current page.
$current_page = (isset($_GET['page']) and in_array($_GET['page'], range(1, $page_count))) ? $_GET['page'] : 1 ;
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Menu's range.
--------------------------------------------------------------------------------------------------------------------------*/
/*---- INFO! ---->
Calculate the menu's range.
*/
#| Calculate the menu's middle point.
$mid_point = floor($menu_length / 2 );
#| Calculate the menu's range.
if($page_count < $menu_length){
#| Not enough pages for the fancy stuff.
$menu_range = range(1, $page_count);
}
elseif($current_page > ($page_count - $mid_point)){
#| Last couple of pages.
$menu_range = range(($page_count - $menu_length) , $page_count);
}
elseif($current_page > $mid_point){
#| Middle pages.
$menu_range = range(($current_page - $mid_point), ($current_page + $mid_point));
}
else{
#| First couple of pages.
$menu_range = range(1, $menu_length);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> DNP.NU beta 3</title>
<LINK REL=StyleSheet HREF="style1.css" TYPE="text/css" MEDIA=screen>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<SCRIPT>
<!-- PopUp Link JavaScript Code Provided By: http://www.DesignerWiz.com - Development Resource & JavaScript Public Archive Center -->
function popUp(page,PWidth,PHeight,id) {
eval("designerwiz"+id+"=window.open('"+page+"','designerwiz1','toolbar=0,scrollbars=1,location=0,status=1,menubars=0,resizable=0,width="+PWidth+",height="+PHeight+"')")
eval;("wiz"+id+".window.moveTo((screen.width/2)-(PWidth/2),(screen.height/2)-(PHeight/2))")
}
</SCRIPT>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
</head>
<body>
<div class="container">
<div class="midden2">
<div class="midden">
<div class="header">
<img src="layout/img/header.png" alt="DNP.NU">
</div>
<div class="divmenu">
<A HREF="javascript:popUp('upload.php',500,250,1);"><img src="layout/img/uploadbutton.png" border=0 alt="Upload jouw video op DNP.NU" align="right"></a>
</div>
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Previous page
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page > 1){
echo '<a href="?page='.($current_page - 1).'"><<</a> ';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Numeric menu.
--------------------------------------------------------------------------------------------------------------------------*/
#| Set " $menu " array for storing all the menu's items.
$menu = array();
#| Create all the menu's items.
foreach($menu_range as $page){
$menu[] = ($page == $current_page) ? '(<a href="?page='.$page.'">'.$page.'</a>) ' : '<a href="?page='.$page.'">'.$page.'</a>' ;
}
#| Display the menu.
echo implode($menu_divider, $menu);
/*--------------------------------------------------------------------------------------------------------------------------
(§) Pagination | Next page.
--------------------------------------------------------------------------------------------------------------------------*/
if($current_page < $page_count){
echo ' <a href="?page='.($current_page + 1).'">>></a>';
}
/*--------------------------------------------------------------------------------------------------------------------------
(§) Alle resultaten ophalen en weergeven.
--------------------------------------------------------------------------------------------------------------------------*/
$query = 'SELECT * FROM dnp2 ORDER BY Datum DESC LIMIT '.mysql_real_escape_string((($current_page - 1) * $results_per_page)).', '.$results_per_page;
$results = mysql_query($query) or die(mysql_error());
// LET OP! Foutafhandeling inbouwen.
while($row = mysql_fetch_assoc($results)){
echo ' <div class="geheel">
<div class="linkerkolom">
<div class="bovenlinks">
<div class="titel"><div class="id">( '.$row['ID'].' ) </div> '.$row['Titel'].'</div>
<div class="datum">'.$row['Datum'].'</div>
</div><br>
<div class="onderlinks">
<div class="bericht"><br><b>'.$row['Plaats'].'</b> - '.$row['Bericht'];
$dirname = "dnpnieuw/items/".$row['ID']."/downloads";
$images = scandir($dirname);
$ignore = array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<br><a href="dnpnieuw/items/'.$row['ID'].'/downloads/'.$curimg.'">Download '.$curimg.'</a><br>';
}
}
echo '</div>
</div>
</div>
<div class="rechterkolom"><img src="layout/img/balkvideo.png" alt="Bekijk onderstaande video">';
$dirname = "dnpnieuw/items/".$row['ID']."/flv/";
$images = scandir($dirname);
$ignore = array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0
width=381 height=216 id=fullscreen align=middle>
<param name="WMode" value="transparent"></param>
<param name=allowScriptAccess value=sameDomain/>
<param name=movie value="flvplayer.swf/>
<param name=quality value=high />
<param name=salign value=tl />
<param name=bgcolor value=#ffffff />
<param name="startimage" value="start_frame.jpg" />
<param name="autoplay" value="0" />
<param name="autoload" value="0" />
<param name="buffer" value="5" />
<param name="buffermessage" value="" />
<param name="buffercolor" value="ffffff" />
<param name="bufferbgcolor" value="858686" />
<param name="buffershowbg" value="0" />
<param name="title" value="20100214 Zwaag carnaval" />
<param name="titlesize" value="20" />
<param name="titlecolor" value="ffffff" />
<param name="margin" value="0" />
<param name="srt" value="0" />
<param name="srtcolor" value="ffffff" />
<param name="srtbgcolor" value="858686" />
<param name="srtsize" value="11" />
<param name="showstop" value="1" />
<param name="showvolume" value="1" />
<param name="showtime" value="1" />
<param name="showplayer" value="autohide" />
<param name="showloading" value="autohide" />
<param name="showfullscreen" value="1" />
<param name="showswitchsubtitles" value="0" />
<param name="showmouse" value="autohide" />
<param name="loop" value="0" />
<param name="startimage" value="start_frame.jpg" />
<param name="playercolor" value="858686" />
<param name="loadingcolor" value="dddddd" />
<param name="bgcolor" value="ffffff" />
<param name="bgcolor1" value="ffffff" />
<param name="bgcolor2" value="ffffff" />
<param name="buttoncolor" value="ffffff" />
<param name="buttonovercolor" value="c3c4c4" />
<param name="slidercolor1" value="ffffff" />
<param name="slidercolor2" value="cccccc" />
<param name="sliderovercolor" value="c3c4c4" />
<param name="loadonstop" value="0" />
<param name="onclick" value="playpause" />
<param name="onclicktarget" value="_blank" />
<param name="ondoubleclick" value="fullscreen" />
<param name="ondoubleclicktarget" value="_blank" />
<param name="playertimeout" value="1500" />
<param name="videobgcolor" value="000000" />
<param name="volume" value="100" />
<param name="shortcut" value="1" />
<param name="playeralpha" value="100" />
<param name="srturl" value="video.srt" />
<param name="top1" value="0" />
<param name="showiconplay" value="1" />
<param name="iconplaycolor" value="ffffff" />
<param name="iconplaybgcolor" value="dddddd" />
<param name="iconplaybgalpha" value="25" />
<param name="showtitleandstartimage" value="0" />
<param NAME=FlashVars VALUE="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'">
<embed wmode="transparent" src=flvplayer.swf FlashVars="file=dnpnieuw/items/'.$row['ID'].'/flv/'.$curimg.'" quality=high
salign=tl bgcolor=#ffffff width=381 height=216 name=fullscreen
align=middle allowScriptAccess=sameDomain type=application/x-shockwave-
flash pluginspage=http://www.macromedia.com/go/getflashplayer/>
</object>';
}
}
echo '
<br>
<img src="layout/img/balkfoto.png" alt="Bekijk onderstaande video">
<div class="fotoalbum"><div class="fotoalbumcenter">';
$dirname = "dnpnieuw/items/".$row['ID']."/foto/";
$images = scandir($dirname);
$ignore = array(".", "..", ".txt", ".TXT");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo '<a href="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" rel="lightbox['.$row['ID'].']"><img img width=109 border=0 height=61 Hspace=5 Vspace=5 src="dnpnieuw/items/'.$row['ID'].'/foto/'.$curimg.'" alt="Foto: DNP.NU"></a>';
}
}
echo '
</div></div>
';
} // End of while loop.
?>
</div></div><br /></div>
</body>
</html>
http://81.30.70.233/~dnp/tester2.php
EDIT: er moest inderdaad 2 keer een div worden afgesloten, dat is nu gebeurd. Nogmaals bedankt!
Gewijzigd op 29/06/2010 19:50:19 door Johan Sebastiaan