вопрос
Всем привет, подскажите пожалуйста если кто знает как сделать (если это возможно) постраничную навигацию в php-native.
public function mainmusic($page, $cstart, $perpage, $sorttype, $sortorder) {
global $member_id, $is_logged;
if($this->config['music_cache_time'] != 0 and $this->config['cache'] != 0) $cache = $this->getCache("mainmusic");
if($cache['time'] and (($cache['time'] + ($this->config['music_cache_time'] * 60)) > time())) {
$data = $cache['data'];
}
else {
$data = array();
$sorttype = $sorttype ? $sorttype : $this->config['sort_type'];
$sortorder = (($sortorder == "ASC") or ($sortorder == "DESC")) ? $sortorder : $this->config['sort_order'];
$page = ($page <= 0) ? 1 : $page;
$perpage = $perpage ? intval($perpage) : $this->config['main'];
$cstart = $cstart ? $cstart : 0;
$cstart = ($page * $perpage) - $perpage;
$sql = $this->db->query("SELECT * FROM ".PREFIX."_music ORDER BY ".$sorttype.' '.$sortorder." LIMIT ".$cstart.",".$perpage);
$countdata = $this->db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_music");
$countall = $countdata['count'];
$totalpages = ceil($countall / $perpage);
while($row = $this->db->get_row($sql)) {
$data[] = $row;
}
if($this->config['music_cache_time'] != 0 and $this->config['cache'] != 0) $this->setCache("mainmusic", $data);
}
foreach ($data as $num=>$music) {
if($music['allow_rate']){
$music['rate-val'] = ($music['rating']>0)?"+".$music['rating']:$music['rating'];
}
if(dle_strlen($music['name'], $this->dleconfig['charset']) > $this->config['titletrack'])
$music['name'] = strip_tags(stripslashes(dle_substr($music['name'], 0, $this->config['titletrack'], $this->dleconfig['charset'])." ..."));
else
$music['name'] = strip_tags(stripslashes($music['name']));
$music['userpage'] = $this->parseUrl('?subaction=userinfo&user='.$music['autor'], 'user/'.$music['autor']."/");
$music['id'] = $music['id'];
$music['server'] = $music['onserver'];
$music['username'] = $music['autor'];
$music['date'] = $this->formatDate($this->config['date_adjust'], $music['date']);
$music['skin'] = $this->dleconfig['http_home_url'] . 'templates/' . $this->dleconfig['skin'];
$category = $music['category'];
$cat = $this->db->query("SELECT name, id, alt FROM " . PREFIX . "_music_category WHERE id='{$category}'");
while ($catrow = $this->db->get_row($cat)) {
$catid = $catrow['id'];
$catname = $catrow['name'];
$cataltname = $catrow['alt'];
}
if($catid and $this->config['category_enable'] != 0) {
$music['catid'] = $this->parseUrl('?do=music&op=category&cat='.$catid, 'music/category/'.$catid);
$music['catname'] = $catname;
}
$data[$num] = $music;
}
return $data;
}
<div class="base">
<div class="heading"><h2><?=$title?></h2></div>
<div class="maincont">
<?php foreach ($music_data as $music){ ?>
<span id="playlist" url="<?=$music['server']?>" class="strack">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<div class="item">
<div class="btn play" id="<?=$music['id']?>" onclick="zpPlayerLoad('<?=$music['server']?>', '<?=$music['name']?>', this.id);"></div>
<div class="title"><?=$music['name']?></div>
</div>
</td>
<td style="width:80px; padding-top:7px;">
<div class="music-orating" id="orating-<?=$music['id']?>">
<a href="#" class="orating_m" onclick="rating_music(<?=$music['id']?>,0);return false;"></a>
<a href="#" class="orating_res" onclick="stats_music(<?=$music['id']?>,1,this);return false;"><?=$music['rate-val']?></a>
<a href="#" class="orating_p" onclick="rating_music(<?=$music['id']?>,1);return false;"></a>
</div>
</td>
<td style="width:16px; padding:10px 5px;">
<a href="<?=$music['download']?>" class="tipsy-top" title="Скачать"><img src="<?=$music['skin']?>/music/img/mp1.png"></a>
</td>
<td style="width:160px;padding-top:1px;">
<div class="track-info">
<span>Добавил:</span> <b><a onclick="showUserHint('<?=$music['username']?>', this); return false;" href="<?=$music['userpage']?>"><?=$music['username']?></a></b><br>
<span>Добавлен:</span> <?=$music['date']?>
<?=$music['category']?>
</div>
</td>
</tr>
</tbody>
</table>
</span>
<?php } ?>
<div class="clr"></div>
</div>
</div>