Postado Janeiro 4, 2019 6 anos bom dia, eu estou tentando deixar meu highscores mais bonito, e gostaria de adcionar uma paginaçao do tipo que apenas clica pra ir a proxima pagina de skills, e a partir da segunda pagina apareça um back pra retornar pra pagina anterior.Assim como nessas fotos : Desde ja agradeço muito , aqui esta meu highscores.php eu removi paginaçao antiga pq era mto feia :P <?php require_once 'engine/init.php'; include 'layout/overall/header.php'; if ($config['log_ip']) { znote_visitor_insert_detailed_data(3); } // Fetch highscore type $type = (isset($_GET['type'])) ? (int)getValue($_GET['type']) : 7; if ($type > 9) $type = 7; // Fetch highscore vocation $configVocations = $config['vocations']; //$debug['configVocations'] = $configVocations; $vocationIds = array_keys($configVocations); $vocation = 'all'; if (isset($_GET['vocation']) && is_numeric($_GET['vocation'])) { $vocation = (int)$_GET['vocation']; if (!in_array($vocation, $vocationIds)) { $vocation = "all"; } } // Fetch highscore page $page = getValue(@$_GET['page']); if (!$page || $page == 0) $page = 1; else $page = (int)$page; $highscore = $config['highscore']; $loadFlags = ($config['country_flags']['enabled'] && $config['country_flags']['highscores']) ? true : false; $loadOutfits = ($config['show_outfits']['highscores']) ? true : false; $rows = $highscore['rows']; $rowsPerPage = $highscore['rowsPerPage']; function skillName($type) { $types = array( 1 => "Club", 2 => "Sword", 3 => "Axe", 4 => "Distance", 5 => "Shield", 6 => "Fish", 7 => "Experience", // Hardcoded 8 => "Magic Level", // Hardcoded 9 => "Fist", // Since 0 returns false I will make 9 = 0. :) ); return $types[(int)$type]; } function pageCheck($index, $page, $rowPerPage) { return ($index < ($page * $rowPerPage) && $index >= ($page * $rowPerPage) - $rowPerPage) ? true : false; } $cache = new Cache('engine/cache/highscores'); if ($cache->hasExpired()) { $vocGroups = fetchAllScores($rows, $config['TFSVersion'], $highscore['ignoreGroupId'], $configVocations, $vocation, $loadFlags, $loadOutfits); $cache->setContent($vocGroups); $cache->save(); } else { $vocGroups = $cache->load(); } if ($vocGroups) { $vocGroup = (is_array($vocGroups[$vocation])) ? $vocGroups[$vocation] : $vocGroups[$vocGroups[$vocation]]; ?> <br><img src="layout/images/titles/t_highscores.png"/><p><br> <h1>Ranking for <?php echo skillName($type) ?></h1> <table> <tbody> <tr><td style="background: none;"> <table id="highscoresTable" class="table table-striped table-hover"> <tbody><tr bgcolor="#20222c"> <td width="6%"class="whites" style=" background-color: #5d5b5b; color: #f9f6f6; ">Rank</td> <td width="40%" class="whites" style=" background-color: #5d5b5b; color: #f9f6f6; ">Name</td> <td width="20%" class="whites" style=" background-color: #5d5b5b; color: #f9f6f6; ">Vocation</td> <td width="15%" class="whites" style=" background-color: #5d5b5b; color: #f9f6f6; ">Level</td> <?php if ($type === 7) echo "<td colspan='1' style='background-color: #5d5b5b; color: #f9f6f6;' >Experience</td>"; ?> </tr> <?php for ($i = 0; $i < count($vocGroup[$type]); $i++) { if ($vocGroup[$type] === false) { ?> <tr> <td colspan="5">Nothing to show here yet.</td> </tr> <?php } else { if (pageCheck($i, $page, $rowsPerPage)) { $flag = ($loadFlags === true && strlen($vocGroup[$type][$i]['flag']) > 1) ? '<img src="' . $config['country_flags']['server'] . '/' . $vocGroup[$type][$i]['flag'] . '.png"> ' : ''; ?> <tr> <?php if ($loadOutfits): ?> <td class="outfitColumn"><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $vocGroup[$type][$i]['type']; ?>&addons=<?php echo $vocGroup[$type][$i]['addons']; ?>&head=<?php echo $vocGroup[$type][$i]['head']; ?>&body=<?php echo $vocGroup[$type][$i]['body']; ?>&legs=<?php echo $vocGroup[$type][$i]['legs']; ?>&feet=<?php echo $vocGroup[$type][$i]['feet']; ?>" alt="img"></td> <?php endif; ?> <td><?php echo $i+1; ?></td> <td><?php echo $flag; ?><a href="characterprofile.php?name=<?php echo $vocGroup[$type][$i]['name']; ?>"><?php echo $vocGroup[$type][$i]['name']; ?></a></td> <td><?php echo vocation_id_to_name($vocGroup[$type][$i]['vocation']); ?></td> <td><?php echo $vocGroup[$type][$i]['value']; ?></td> <?php if ($type === 7) echo "<td>". $vocGroup[$type][$i]['experience'] ."</td>"; ?> </tr> <?php } } } ?> </table> <th width="15%" valign="top" align="right"> <table border="0" cellpadding="1" cellspacing="1"> <tbody><tr bgcolor="#20222c"> <td class="whites" style=" background-color: #5d5b5b; color: #f9f6f6; ">Choose a Skill</td> </tr> <tr bgcolor="#1b1e26"> <td> <a href="highscores.php" class="size_xs">Experience</a><br> <a href="highscores.php?type=8&vocation=all&page=1" class="size_xs">Magic</a><br> <a href="highscores.php?type=5&vocation=all&page=1" class="size_xs">Shielding</a><br> <a href="highscores.php?type=4&vocation=all&page=1" class="size_xs">Distance</a><br> <a href="highscores.php?type=9&vocation=all&page=1" class="size_xs">Fist</a><br> <a href="highscores.php?type=2&vocation=all&page=1" class="size_xs">Sword</a><br> <a href="highscores.php?type=3&vocation=all&page=1" class="size_xs">Axe</a><br> <a href="highscores.php?type=1&vocation=all&page=1" class="size_xs">Club</a><br> <a href="highscores.php?type=6&vocation=all&page=1" class="size_xs">Fishing</a><br> </td> </tr> </tbody></table> </th></tr></tbody></table> <?php } include 'layout/overall/footer.php'; ?> Editado Janeiro 4, 2019 6 anos por celohere (veja o histórico de edições)
Postado Janeiro 9, 2019 6 anos Pra znote eu não sei muito bem, mas seria algo assim <ul class="pagination"> $pages = (int)($rows / $rowsPerPage); for ($i = 0; $i < $pages; $i++) { $x = $i + 1; <li '. (($x - 1) == $page ? 'class="active"' : '') .'><a href="?view=highscores&skill='.urlencode($list).'&page='.($x - 1).'" data-original-title="" title="">'.($x).'</a></ul></li> }
Postado Janeiro 13, 2019 6 anos Autor Em 09/01/2019 em 19:15, Yinz disse: Pra znote eu não sei muito bem, mas seria algo assim <ul class="pagination"> $pages = (int)($rows / $rowsPerPage); for ($i = 0; $i < $pages; $i++) { $x = $i + 1; <li '. (($x - 1) == $page ? 'class="active"' : '') .'><a href="?view=highscores&skill='.urlencode($list).'&page='.($x - 1).'" data-original-title="" title="">'.($x).'</a></ul></li> } obrigado pela resposta ,mas nao funcionou =( , eu consegui uma mais ou menos , nao e do jeito que eu queria mas talvez de pra modificar <span class="pagination" float: "right"> <?php $pages = ceil(min(($highscore['rows'] / $highscore['rowsPerPage']), (count($scores[$type]) / $highscore['rowsPerPage']))); for ($i = 0; $i < $pages; $i++) { $x = $i + 1; if ($x == $page) echo "<a href=\"?".$_SERVER['QUERY_STRING']."&pag=".$x."\" class=\"current\">".$x."</a>"; else echo "<a href=\"?".$_SERVER['QUERY_STRING']."&pag=".$x."\">".$x."</a>"; } ?> </span>
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.