Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //$row['guide'] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaa#PAGE_BREAK#bbbbbbbbbbbbbbbbbbbbbbbbb#PAGE_BREAK#ccccccccccccccccccccccccccc";
- //$_GET['page']=2;
- /* visa sidan */
- $pages = explode('#PAGE_BREAK#',$row['guide']);
- /* fetch the page nr from the url */
- $page_nr = (int) $_GET['page'];
- /* lägsta tillåtna är 1 */
- $page_nr = max(1, $page_nr);
- /* högsta är samma som antal sidor */
- $page_nr = min($page_nr, count($pages));
- /* finns det mer än 1 sida? */
- if(count($pages) > 1)
- {
- /* Make a list whit links for all pages */
- $page_links = array();
- foreach(range(1, count($pages)) as $page_link_nr)
- {
- $page_links[$page_link_nr] = "<a href='?page={$page_link_nr}'>{$page_link_nr}</a> ";
- }
- /* replace the link for the current page */
- $page_links[$page_nr] = "<b>{$page_nr}</b>";
- /* print all links whit | between */
- echo implode(" | ", $page_links);
- }
- /* echo the page */
- echo $pages[$page_nr-1];
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement