Jump to content

Search the Community

Showing results for tags 'pagination'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 10 results

  1. gordonisnz

    Help with pagination - w3css

    Hello. Ive recently joined this forum. a week or so ago I found the W3CSS pages & they are great. http://www.w3schools.com/w3css/default.asp Ive found the HTML / CSS code for pagination, & i thinki want to use it, however I am a bit puzzled. http://www.w3schools.com/w3css/w3css_pagination.asp example: <li><a href="#">2</a></li> <li><a href="#">3</a></li> can anyone advise what else is needed to use this system ? How does my website KNOW if i clicked page 1, page 2, or page 3 ? all the targets point to a hash-tag # Basically my main site runs on PHP, so i would appreciate any assistance in understanding a) how the script / website knows what value is selected how to pass this value to a php script as named value. - Eg $page Also - it would be good if the pagination page be updated to point to a few tutorials. Thank you.
  2. elcaiaimar

    problem with pagination

    Hello, I'm doing a pagination to my table but I'm having a problem with elements position. Pagination works fine but elements are really very close, as you can see in the attached images. I've tried to change things but nothing happens. Does anyone know how to solve it? I put my code below. Thank you very much! CSS: #page_navigation a{ padding:3px; border:1px solid gray; margin:2px; color:black; text-decoration:none}.active_page{ background:darkblue; color:white !important; width:100%;} JS: $(document).ready(function(){ //how much items per page to show var show_per_page = 5; //getting the amount of elements inside content div var number_of_items = $('.paginacion').children().size(); //calculate the number of pages we are going to have var number_of_pages = Math.ceil(number_of_items/show_per_page); //set the value of our hidden input fields $('#current_page').val(0); $('#show_per_page').val(show_per_page); //now when we got all we need for the navigation let's make it ' /* what are we going to have in the navigation? - link to previous page - links to specific pages - link to next page */ var navigation_html = '<a class="previous_link" href="javascript:previous();">Prev</a>'; var current_link = 0; while(number_of_pages > current_link){ navigation_html += '<a class="page_link" href="javascript:go_to_page(' + current_link +')" longdesc="' + current_link +'">'+ (current_link + 1) +'</a>'; current_link++; } navigation_html += '<a class="next_link" href="javascript:next();">Next</a>'; $('#page_navigation').html(navigation_html); go_to_page(0); });function previous(){ new_page = parseInt($('#current_page').val()) - 1; //if there is an item before the current active link run the function if($('.active_page').prev('.page_link').length==true){ go_to_page(new_page); } }function next(){ new_page = parseInt($('#current_page').val()) + 1; //if there is an item after the current active link run the function if($('.active_page').next('.page_link').length==true){ go_to_page(new_page); } }function go_to_page(page_num){ //get the number of items shown per page var show_per_page = parseInt($('#show_per_page').val()); //get the element number where to start the slice from start_from = page_num * show_per_page; //get the element number where to end the slice end_on = start_from + show_per_page; //hide all children elements of content div, get specific items and show them $('.paginacion').children().css('display', 'none').slice(start_from, end_on).css('display', 'block'); /*get the page link that has longdesc attribute of the current page and add active_page class to it and remove that class from previously active page link*/ $('.page_link[longdesc= + page_num +]').addClass('active_page').siblings('.active_page').removeClass('active_page'); //update the current page input field $('#current_page').val(page_num);} Template: <!-- the input fields that will hold the variables we will use --> <input type='hidden' id='current_page' /> <input type='hidden' id='show_per_page' /> <div id="tab1" class="tab active"> {% if results %} <table class="table table-hover" id="tabla_productos"> <thead> <tr> <th>Codpozo</th> <th>Coor X</th> <th>Coor Y</th> <th>Tipo</th> </tr> </thead> {% for p in results %} <tbody class="paginacion"> <tr id="tr{{p.id}}"> <td>{{ p.codpozo }}</td> <td>{{ p.coorx }}</td> <td>{{ p.coory }}</td> <td>{{ p.tipo }}</td> {% if user.is_authenticated and user.is_staff %} <td><a href="#myModal" role="button" class="btn btn-danger delete" data-toggle="modal" id="{{p.id}}" data-name="{{p.codpozo}}">Eliminar</a></td> {% endif %} </tr> </tbody> {% endfor %} </table> <div id='page_navigation'></div> {% else %} <h2>No existen pozos</h2> {% endif %} </div>
  3. I have 4 Column ( id (primary) , a, b ,c ,d ) --------------------------------------------------------------------------------------------------------------------------------ID | A | B | C ( where C = SUM B ) | D ( where D = C / A1 , Where A1 = 6 )-------------------------------------------------------------------------------|------------------------------------------------1 | 4 | 3 | 8 | 22 | 6 | 2 | | 3 | 1 | 3 | | -------------------------------------------------------------------------------|-------------------------------------------------- How i can display such table with pagination . Both A , B value are Input text Field , which entry are made by user side and its stored in Database table , but C value is addition of B (TOTAL) . where C = SUM B where D = C / A1 , Where A1 = 6 HENCE how i can get C,D as A,B coloumn get increment , and c,d will be calculation of it , hence how i can show such TABLE VIEW with Pagination . note : Not tried any thing , as i am bit confuse how to start
  4. etsted

    pagination

    i am trying to create a pagination, but when i run this script my browser wont let me do it. Error from my browser: This webpage has a redirect loop the script: include "connect.php"; $per_page = 5; $pages_query = mysql_query("SELECT COUNT(id) FROM bruker") or die(mysql_error()); $pages = ceil(mysql_result($pages_query, 0) / $per_page); if(!isset($_GET['pages'])) { header("location: pagination.php?page=1"); } else { $page = $_GET['page']; } $start = (($page - 1) * $per_page); $bruker = mysql_query("SELECT * FROM bruker LIMIT $start, $per_page"); while($row = mysql_fetch_assoc($bruker)) { $bruker = $row['bruker']; echo $bruker . "<br />"; }
  5. hi, i need php auto scroll pagination for the website http://unitedwebsoft.in/. Can anyone pls help me or send me any tutorial link
  6. etsted

    combining

    i have to scripts i want to combine, but i am not sure how to, could someone show me? search script: <h1>Search:</h1> <form action="search.php" method="get" class="search"> <input type="text" name="k" size='50' /> <input type="submit" name="submit" value='Search' /> </form> <?php $username = $_SESSION['username']; if(isset($username)) { include "navigator/navigator_login.php"; } else { include "navigator/navigator.php"; } ?> <hr /> <?php // also check out facebook and twitter like buttons include "connect.php"; $k = mysqli_real_escape_string($con, htmlentities(trim($_GET['k']))); $terms = explode(" ", $k); $query = "SELECT * FROM videos WHERE "; $i = 0; foreach($terms as $each) { $i++; if($i == 1) { $query .= "description LIKE '%$each%' "; } else { $query .= "OR description LIKE '%$each%' "; } } $result = mysqli_query($con, $query) or die(mysqli_error($con)); $numrows = mysqli_num_rows($result); if($numrows > 0) { while($row = mysqli_fetch_array($result)) { $id = $row['id']; $title = $row['title']; $url = $row['url']; $description = $row['description']; if($k == "") { echo ""; } else { echo "<h3><a href='$url'>$title</a></h3> $description"; } } } else { echo "no results on $k"; } mysqli_close($con); pagination script: include "connect.php"; $count_query = mysql_query("SELECT NULL FROM bruker"); $count = mysql_num_rows($count_query); if(isset($_GET['page'])) { $page = preg_replace("#[^0-9]#","",$_GET['page']); } else { $page = 1; } $perPage = 10; $lastPage = ceil($count/$perPage); if($page < 1) { $page = 1; } else { if($page > $lastPage) { $page = $lastPage; } } $limit = "LIMIT " . ($page - 1) * $perPage . ", $perPage"; $query = mysql_query("SELECT name FROM bruker ORDER BY id DESC $limit"); if($lastPage != 1) { if($page != $lastPage) { $next = $page + 1; $pagination .= '<a href="pagination.php?page='.$next.'">Next</a>'; } if($page != 1) { $prev = $page - 1; $pagination .= '<a href="pagination.php?page='.$prev.'">Previous</a>'; } } while($row = mysql_fetch_array($query)) { $output .= $row['name'] . "<br />"; } echo $output; echo $pagination;
  7. Lykos22

    Create pagination links and function

    Hi, I'd like some help please. I'm trying to create a pagination that will display the links of the pages like this:<a href="#">First Page</a><a href="#">Previous Page</a><a href="#">Next Page</a><a href="#">Last Page</a>Not showing numbers Here's my code so far: <?php$per_page = 20;$page = (isset($_GET['page']) === true) ? (int)$_GET['page'] : 0;$start = $page * $per_page; $query = "SELECT `users`.`user_id` AS `id`, `users`.`first_name` AS `firstname` , `users`.`last_name` AS `lastname`, `users`.`email` AS `email`, FROM `users` ORDER BY `users`.`user_id` DESC"; $query_limit = sprintf("%s LIMIT %d, %d", $query, $start, $per_page);$sql = mysqli_query($connection, $query_limit) or die(mysqli_error());$row_sql = mysqli_fetch_assoc($sql); $all = mysqli_query($connection, $query);$total_rows = mysqli_num_rows($all); $total_pages = ceil($total_rows/$per_page)-1;//$previous_page = ($page > 0) ? $page - 1 : 0;//$next_page = $page + 1;?><html>....<?php do { ?><td><?php echo $row_sql['firstname']; ?></td><td><?php echo $row_sql['lastname']; ?></td><td><?php echo $row_sql['email']; ?></td><?php } while ($row_sql = mysqli_fetch_assoc($sql)); ?>...<!--- pagination links go here ---> Is it also possible to put it and inside a function where I can pass the $query and the $per_page so that I can re-use it???
  8. nachdenkblog

    Blog Pagination (Tumblr)

    Hey guys, I have the following problem: On my blog (http://nachdenkblog.tumblr.com) I want to make it possible to switch directly between the blog entries.At the bottom of the main site you can see pagination between the sites. (BTW, it's in German but I guess you see what it means.) But if you open a specific entry you can see a similar but smaller footer without links to click.The code I used for this is the following: {block:PermalinkPage} <div class="FUSSBEREICH PERMA"> <div class="SCHATTEN"> </div> <div class="FUSS"> <div class="NAVIGATION"> {block:Pagination} <ul> {block:PreviousPost} <li> <a href="{PreviousPost}"> Vorheriger Eintrag </a> </li> {/block:PreviousPost} {block:NextPost} <li> <a href="{NextPost}"> Nächster Eintrag </a> </li> {/block:NextPost} </ul> {/block:Pagination} </div> </div> </div> {/block:PermalinkPage} (In case you need to know: FUSSBEREICH = footer; SCHATTEN = shadow; FUSS = foot)But as I said, no link at all is displayed. Can someone tell me why? Regards,Thomas
  9. divinedesigns1

    Pagination problem

    hello, im having problem using this pagination within a while loop that fetch items from the db (not my code, didnt know how to create one so i looked it up also its a old code) the code originally use mysql but since my connection uses mysqli i changed it to match my database, the code seem to be correct but when i added it to my other script that fetch the items it doesnt out. also when using pagination doesnt it need to use the table names from the database? this is the code im using <?php include_once("php/config.php"); $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news ORDER BY date DESC"; $result = mysqli_query($con, $query);$nr = mysqli_num_rows($result);if(isset($_GET['id'])){ $pn = preg_replace('#[^0-9]#i', '', $_GET['id']);}else{ $pn = 1;}$itemsPerPage = 8;$lastPage = ceil($nr / $itemsPerPage);if($pn < 1){ $pn = 1;}else if($pn > $lastPage){ $pn = $lastPage; } // creating the numbers $centerPages = ""; $sub1 = $pn -1; $sub2 = $pn -2; $add1 = $pn +1; $add2 = $pn +2; if($pn == 1){ $centerPages .= ' <span class"PageNumActive">' . $pn . '</span> '; $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '">' . $add1 . '</a> '; }else if($pn == $lastPage){ $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '">' . $sub1 . '</a> '; $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> '; }else if($pn >2 && $pn<($lastPage - 1)){ $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub2 . '">' . $sub2 . '</a> '; $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '">' . $sub1 . '</a> '; $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> '; $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '">' . $add1 . '</a> '; $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add2 . '">' . $add2 . '</a> '; }else if($pn >1 && $pn < $lastPage){ $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '">' . $sub1 . '</a> '; $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> '; $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '">' . $add1 . '</a> '; } // creating the limit variable $limit = 'LIMIT' . ($pn - 1)* $itemsPerPage . ',' . $itemsPerPage; // now adding the limit variable to the query $query2 = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news ORDER BY date DESC $limit"; // Displaying the pagination $paginationDisplay = ""; if($lastPage != "1"){ $paginationDisplay .= 'Page <strong>' . $pn . '</strong> of' . $lastPage . ' '; // Determining if the person is on page one if($pn != 1){ $previous = $pn - 1; $paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $previous . '">back</a>'; // adding the numbers in the middle of both back and next $paginationDisplay .= '<span class="paginationNumbers">' . $centerPages . '</span>'; // now add the next button if($pn != $lastPage){ $nextPage = $pn +1; $paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $nextPage . '">next</a>'; } } } $result = mysqli_query($con, $query2); if($result){ while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){ echo '<table width="600" border="0" align="center" bgcolor="#FFFFFF"><tr>'; echo '<td width="70" align="left" valign="bottom">Topic:</td>'; echo '<td colspan="2" align="left" valign="bottom" bgcolor="#FFFFFF">' . $row['title'] . '</td></tr>' . '<br />'; echo '<tr><td align="left" valign="bottom">Author:</td>'; echo '<td colspan="2" align="left" valign="bottom" bgcolor="#FFFFFF">' . $row['author'] . '</td></tr>' . '<br />'; echo '<tr><td align="left" valign="top">Article:</td>'; echo '<td colspan="2" align="left" valign="bottom" bgcolor="#FFFFFF">' . $row['post'] . '</td></tr>' . '<br />'; echo '<tr><td align="left" valign="bottom"> </td>'; echo '<td width="396" align="left" valign="bottom"> </td>'; echo '<td width="120" valign="bottom" bgcolor="#FFFFFF">' . $row['sd'] . '</td></tr>'; echo '</table>'; } }else { echo "There\'s Are No News Post(s) To Display"; } ?> what the above code suppose to do, is when 8 topics is displayed, and if theres more in the database, it give you the option to go to the next page etc etc and if theres only 2 pages it give you the option to go back to the first page etc etc. but im not being able to display anything. any tip, suggestion, etc would be greatly appreciated
  10. Hi everybody can anybody help me by providing links or ssample code to perform pagination on dynamic results....actually i have search box in my application and i am getting search results from the remote url ,i would like to perform pagination.Because if my search results are more i need to scroll the page for seeing the results.instead of that i would like to done the pagination which will allow 10 results per page. pls help me...Thanx in advance.....
×