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
|
<?php require_once('../webadmin/configure.php'); $result0 = mysql_query("SELECT * FROM home "); $row0 = mysql_fetch_array($result0,MYSQL_ASSOC); $result = mysql_query("SELECT * FROM sys_menu WHERE mpage = 'press' "); $row = mysql_fetch_array($result,MYSQL_ASSOC);
$result1 = mysql_query("SELECT * FROM press WHERE pressid = ".safe_param($_GET['pressid'])." AND presspagemodule = 'pressnews' AND pressstatus = '1' ORDER BY presssort ASC "); if (mysql_num_rows($result1) > 0){ $row1 = mysql_fetch_array($result1,MYSQL_ASSOC); } else { header("Location: index.php"); } ?><!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" /> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title><?=$row1{'metatitleen'};?></title> <meta name="keywords" content="<?=$row1{'metakeyworden'};?>" /> <meta name="description" content="<?=$row1{'metadescen'};?>" /> <link rel="stylesheet" type="text/css" href="../css/style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript" src="../js/jquery.cycle.all.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.banner').cycle({ fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc... }); }); </script>
</head> <body> <div id="container"> <!-- Header --> <?php require_once('header.php');?> <!-- Main Content --> <div id="body"> <div id="body_content"> <div id="submenu"> <ul><?php // Left Menu $result3 = mysql_query("SELECT * FROM press WHERE pressstatus = '1' ORDER BY presssort ASC "); while ($row3 = mysql_fetch_array($result3,MYSQL_ASSOC)){ echo "<li><a href='".$row3{'presspagemodule'}.".php?pressid=".$row3{'pressid'}."'>".$row3{'presstitleen'}."</a></li>"; }?> </ul> </div> <div id="maincontent"> <?php if(!empty($row1{'pressbanneren'})) { echo '<div id="pagebanner"><a href="'.$row1{'pressbannerlinken'}.'"><img src="../pagebanner/'.$row1{'pressbanneren'}.'" width="670" /></a></div>'; }?> <div id="pagetitle" class="pagetitle"><?=$row1{'presstitleen'};?></div> <div id="path" class="path"><a href="index.php">Home</a> > <?=$row{'mtitleen'};?> > <?=$row1{'presstitleen'};?></div> <?php if(empty($_GET['prenewid'])) { ?> <div id="pagecontent" class="pagecontent"> <?php //$tbl_name="property"; //your table name // How many adjacent pages should be shown on each side? $adjacents = 5; /* First get total number of rows in data table. If you have a WHERE clause in your query, make sure you mirror it here. */ //$query = "SELECT COUNT(*) as num FROM $tbl_name"; $query = "SELECT COUNT(*) as num FROM press_news WHERE pressid = ".$row1{'pressid'}." AND prenewstatus = '1' AND prenewtitleen <> '' "; //echo 'query'.$query.'<br />'; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; /* Setup vars for query. */ $targetpage = "pressnews.php"; //your file name (the name of this file) $limit = 10; //how many items to show per page $page = $_GET['page']; if($page) $start = ($page - 1) * $limit; //first item to display on this page else $start = 0; //if no page var is given, set start to 0 /* Get data. */ $sql5 = "SELECT * FROM press_news WHERE pressid = ".$row1{'pressid'}." AND prenewstatus = '1' AND prenewtitleen <> '' "; $sql5 .= "ORDER BY prenewsort ASC LIMIT $start, $limit "; //echo $sql5; $result5 = mysql_query($sql5);
/* Setup page vars for display. */ if ($page == 0) $page = 1; //if no page var is given, default to 1. $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 $pagination = ""; if($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page > 1) $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$prev\">«</a>"; else $pagination.= "<span class=\"disabled\">«</span>"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$counter\">$counter</a>"; } } elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$lastpage\">$lastpage</a>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=2\">2</a>"; $pagination.= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$lastpage\">$lastpage</a>"; } //close to end; only hide early pages else { $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=2\">2</a>"; $pagination.= "..."; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{ if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$counter\">$counter</a>"; } } } //next button if ($page < $counter - 1) $pagination.= "<a href=\"$targetpage?pressid=".$row1{'pressid'}."&page=$next\">»</a>"; else $pagination.= "<span class=\"disabled\">»</span>"; $pagination.= "</div>\n"; }
?> <table width="670" border="0" cellspacing="0" cellpadding="0"> <?php while ($row5 = mysql_fetch_array($result5,MYSQL_ASSOC)){?> <tr> <td width="100" align="left" valign="top" class="newslist-date"><?=$row5{'prenewdate'};?></td> <td align="left" valign="top" class="newslist-title"><a href="pressnews.php?pressid=<?=$row1{'pressid'};?>&prenewid=<?=$row5{'prenewid'};?>"><?=$row5{'prenewtitleen'};?></a></td> </tr> <?php } ?> </table> </div> <div id="pagination"><?=$pagination;?></div> <?php } else { ?> <div id="pagecontent" class="pagecontent"> <?php // Press Detail $result4 = mysql_query("SELECT * FROM press_news WHERE prenewid = ".safe_param($_GET['prenewid'])." AND prenewstatus = '1' "); $row4 = mysql_fetch_array($result4,MYSQL_ASSOC); echo '<b>'.$row4{'prenewtitleen'}.'</b><br />'.$row4{'prenewdate'}.'<br /><br />'.$row4{'prenewdescen'}.'<br /><br /><br /><br /><a href="pressnews.php?pressid='.$row4{'pressid'}.'"><u>← back</u></a>'; ?> </div> <?php } ?> </div> <div class="clear"></div> </div> </div> <!-- Footer --> <?php require_once('footer.php');?> </div> </body> </html>
|