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
|
<?php require_once($LIBPATH . "utilfunc.php"); require_once("../conf_/siteconf_.php"); require_once("../admin/dbconn.php");
if (isset($_POST['year'])) $year = $_POST['year']; elseif (isset($_GET['year'])) $year = $_GET['year']; else $year = date('Y')-1;
if($dbConn) { $self = "index.php?pg=arhiva&year=".$year; // If you use this code with a different page ( or file ) name then change this // how many rows to show per page $rowsPerPage = 10; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])){ $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $sql_all = "SELECT * FROM stiri WHERE YEAR(Datas) = ".$year." AND Activs = 1 ORDER BY Datas DESC"; $result_all = @mysql_query($sql_all); $num_rows = mysql_num_rows($result_all); $sql = "SELECT * FROM stiri WHERE YEAR(Datas) = ".$year." AND Activs = 1 ORDER BY Datas DESC LIMIT $offset, $rowsPerPage"; $result = @mysql_query($sql); $numnow_rows = mysql_num_rows($result); $news = ""; if ($numnow_rows == 0) { $news = "<tr><td align=\"center\" height=\"35\" style=\"padding:10px;\">In Arhiva ".$year." nu exista stiri.</td></tr>"; } else { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $news .= ' <tr> <td> <table cellpadding="0" cellspacing="0" border="0" summary="" width="100%" style="padding:10px;"> <tr> <td '; if ($row['Imagine'] !== "") $news .= ""; $news .= '><b>' . $row['Titlu'] . '</b><br>' . substr($row['Continut'], 0, 700) . '<br><br><a href="index.php?pg=arhstire&id=' . $row['ID'] . '&year='.$year.'"><img src="../ro/images/icon-maimult_albume.png" data-srcover="../ro/images/icon-maimult_albume_w.png" alt="Click mai mult" style="width:76px;height:20px;border:0"></a></td>'; if ($row['Imagine'] !== "") $news .= '<td valign="top" align="right" style="padding-left:10px;padding-bottom:10px;"><a href="index.php?pg=arhstire&id=' . $row['ID'] . '&year='.$year.'"><img src="../images/stiri/' . $row['Imagine'] .'" alt="'.$ra_page[0]->Titlu.'" width="200" onerror="this.src=\'../images/stiri/noimg.jpg\';" border="0" style="border: 5px solid #fff"></a></td>'; $news .= '</tr> </table> </td> </tr>'; $news .= "<tr><td></br></br></td></tr>"; } // how many pages we have when using paging? $maxPage = ceil($num_rows/$rowsPerPage); // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page one if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self&page=$page\">[Anterioara]</a> "; $first = " <a href=\"$self&page=1\">[Prima]</a> "; } else { $prev = ' [Anterioara] '; // we're on page one, don't enable 'previous' link $first = ' [Prima] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self&page=$page\">[Urmatoare]</a> "; $last = " <a href=\"$self&page=$maxPage\">[Ultima pagina]</a> "; } else { $next = ' [Urmatoare] '; // we're on the last page, don't enable 'next' link $last = ' [Ultima pagina] '; // nor 'last page' link } // print the page navigation link $news .= "<tr><td align=\"center\" height=\"35\">" . $first . $prev . " Pagina <strong>$pageNum</strong> din <strong>$maxPage</strong> pagini " . $next . $last."</td></tr>"; } //mysql_free_result($result); } $title .=""; $yearCurrent = date(Y); ?>
<td valign="top" style="border-right: 1px solid #5D5C5C" width="589">
<table cellpadding="0" cellspacing="0" border="0" summary=""> <tr>
<td bgcolor="#252525" height="23" width="589" class="adr2"><a href="index.php" class="adr2">Home</a> » <a href="index.php?pg=news" class="adr2">Stiri</a> » Arhiva <?= $year; ?></td> </tr> <tr> <td> </td> </tr> <tr> <td align="center"><form id="form1" method="get"> <input type = 'hidden' name = 'pg' value = 'arhiva' /> <br>Selectati anul:<br><?php $select = '<select name="year" id="year" onchange="document.getElementById(\'form1\').submit()">'; foreach($anarh as $key => $value){ if ($yearCurrent != $key){ //archiva doesn't include the current year! $select .= '<option value="'.$key.'" '; if ($year == $key) $select .= ' SELECTED'; $select .= '>' . $value.'</option>'; } } $select .= '</select>'; echo $select; ?> <input type = 'hidden' name = 'page' value = '1' /> </form></td> </tr> <tr> <td> </td> </tr>
<?= $news; ?> <tr> <td> </td> </tr>
</table>
</td>
|