Jump to content

Search the Community

Showing results for tags 'pagination'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

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


Age


Donation Link

  1. Hello. I have a page that displays data from a database based on pagination. All works well if I display all records (19 at the moment), but if I choose to view 8, or 10, or less than 19, I see duplicates of the same data, as well as new data not showing. How can I prevent duplications and have new date viewed without having to view all data? include("headsection.php"); include("nav.php"); if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $num_per_page = 20; $start_from = ($page -1) * 2; $sql = "SELECT * FROM people ORDER BY id ASC LIMIT $start_from, $num_per_page"; $result = $con->query($sql); if( $result->num_rows > 0) { ?> <h1 class="center">List of all Users</h1> <table class="container3"> <tr> <td width="auto">PID</td> <td width="auto">Name</td> <td width="auto">Relationship</td> <td width="auto" class="center" colspan="3">Actions</td> </tr> <form action="" method="POST"> <?php while( $row = $result->fetch_assoc()){ echo "<input type='hidden' value='". $row['id']."' name='id'>"; //added echo "<tr>"; echo "<td class='success'>".$row['pid'] . "</td>"; echo "<td class='success'>".$row['name'] . "</td>"; echo "<td class='success'>".$row['relationship'] . "</td>"; echo "<td><a href='view.php?id=".$row['id']."' class='primary' title='view'>V</a></td>"; echo "<td><a href='edit.php?id=".$row['id']."' class='warning' title='edit'>E</a></td>"; echo "<td><a href='delete.php?id=".$row['id']."' class='danger' title='delete'>D</a></td>"; echo "</tr>"; } ?> </form> </table> <?php $pr_query = "SELECT * FROM people ORDER BY id"; $pr_result = $con->query($pr_query); $total_record = mysqli_num_rows($pr_result); //echo $total_record; $total_page = ceil($total_record/$num_per_page); echo "<h3 class='center'>Number of records in database: " . $total_record . "</h3>"; echo "<p class='center'>"; if ($page > 1 ){ echo "<a class='primary' href='users.php?page=".($page-1)."'>Previous</a>"; } for($i=1; $i<$total_page; $i++) { echo "<a class='primary' href='users.php?page=".$i."'>$i</a>"; } if ($i > $page ){ echo "<a class='primary' href='users.php?page=".($page+1)."'>Next</a>"; } echo "</p>"; ?> <br><br> <?php } else { echo "<br><br>No Record Found"; } ?> <?php include("footsection.php"); ?> As the site is localhosted, i am using mysqli - the site will not be online. Thanks in advance for any help.
  2. Hi folks, brand new here and hope that you can help me; I'm looking for very generic pagination for my page. I'll paste in some html and go from there: <div class="row paginate"> <div class="col-12"> <nav> <a href="index.php" class="active">01</a> <a href="index-02.php">02</a> <a href="index-03.php">03</a> <a href="index-04.php">04</a> <a href="index-05.php">05</a> </nav> </div> </div> What I'm looking for is php inside of the link to echo the .active class based on whether or not you're on the index-02.php page or index-03.php page etc... I'm not using any mysql for this so I hope it's possible. I also plan on putting that chunk of html in an include file so I don't have to manually keep adding new links to every page :/ The site it's going on is one of my own at http://www.harshclimate.com/photos if you wanna see the entire HTML Thanks, all!
  3. Hi I'm trying to make a "pagination" for my webpage so people can flick through several pages of images (6 columns by 4 rows). The code is meant to check how many pages are needed and display a maximum of 5 page links, 2 links for the pages before the current page and 2 links for the pages just after. Anyway, I have tested it and the if statements are only read when the for loop is removed however the latter is necessary for this code to work. Also I'm very basic in my coding as I'm still new. here is my code: if ($numberofobjects > '23') { function getCurrentPageUrl() { $pageURL = 'http'; if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } $hrefpages = getCurrentPageUrl(); $draftnumberofpages = $numberofobjects / '24'; $numberofpages = count($draftnumberofpages, 0, PHP_ROUND_HALF_UP); $currentpage = substr($hrefpages, -1); $linkwithoutpage = substr($hrefpages, 0, -1); $prevpage1 = $currentpage - '1'; $nextpage1 = $currentpage + '1'; $prevpage2 = $currentpage - 2; $nextpage2 = $currentpage + 2; $keepgoing = '0'; $currentpagination = '0'; $nomoreprev = '0'; $nomorenext = '0'; echo '<div class="row"></div>'; echo '<div class="row"></div>'; echo '<div class="pagination-centered"> <ul class="pagination">'; if ($currentpage != '1') { echo '<li class="arrow"><a href="'.$linkwithoutpage.$prevpage1.'">«</a></li>'; } for ($paginationincrement = 0; $paginationincrement == 5; $keepgoing++) { if ($prevpage2 >= 1) { echo '<li ><a href="'.$linkwithoutpage.$prevpage2.'">'.$prevpage2.'</a></li>'; echo '<li ><a href="'.$linkwithoutpage.$prevpage1.'">'.$prevpage1.'</a></li>'; $paginationincrement + 2; $nomoreprev = '1'; } if ($prevpage1 >= 1 && $nomoreprev != 1 ) { echo '<li ><a href="'.$linkwithoutpage.$prevpage1.'">2</a></li>'; $paginationincrement ++; } if ($currentpagination == '0') { $paginationarray = '<li class="current"><a href="#">'.$currentpage.'</a></li>'; $paginationincrement++; $currentpagination = '1'; } if ($nextpage2 <= $numberofpages) { echo '<li ><a href="'.$linkwithoutpage.$nextpage2.'">'.$nextpage1.'</a></li>'; echo '<li ><a href="'.$linkwithoutpage.$nextpage1.'">'.$nextpage2.'</a></li>'; $paginationincrement + 2; $nomorenext = 1; } if ($nextpage1 <= $numberofpages && $nomorenext != 1) { echo '<li ><a href="'.$linkwithoutpage.$nextpage1.'">'.$nextpage1.'</a></li>'; $paginationincrement ++; } if ($paginationincrement == $numberofpages) { $paginationincrement = 5; } } if ($currentpage != $numberofpages) { echo '<li class="arrow"><a href="'.$linkwithoutpage.$prevpage1.'">»</a></li>'; } echo ' </ul> </div></div>'; }
  4. Hi, I'm having a real problem with one of my Wordpress category pages. I use a 3-column grid system on this page and just recently I needed to add an advert to the page, so I thought I would do one query at the top with the first two posts, then add the advert to complete the row. Then I would use a second query underneath creating the posts using the traditional grid system with 3 in each row. This is working well except for the pagination, which adds the two items form the first query everytime it paginates. You can see this in action at http://soundsandcolours.com/music/ Does anyone know what I can do to make the Pagination ignore the first query, and just keep running the second query instead. I've included all of my code below: 1st Query: $query_string; $musiccat_posts = new WP_Query($query_string."&posts_per_page=2"); if ($musiccat_posts->have_posts()): $musiccatIDs = array(); while($musiccat_posts->have_posts()):$musiccat_posts->the_post(); $musiccatIDs[] = get_the_ID(); 2nd Query: $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; global $moremusiccat_query; $music_args = array( 'cat' => 1841, 'posts_per_page' => 15, 'post__not_in' => $musiccatIDs, 'paged' => $paged ); $moremusiccat_query = new WP_Query( $music_args ); while ($moremusiccat_query -> have_posts()) : $moremusiccat_query -> the_post(); ?> Pagination Code: $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $moremusiccat_query->max_num_pages ) ); Any help would be massively appreciated!
  5. Have basic article directory and i'm busy with pagination. And i want to have it shortlinked. Structure of the link looks like this: Without pagination <a href='moving-articles/category/$sublink/'>$sublink</a> rewrite rule in .htaccess look like this RewriteRule moving-articles/(.*)/(.*)/$ /moving-articles.php?$1=$2 That works perfectly fine. So the problem i have here, one i try to add pagination. Link structure is like this for example: <a href='moving-articles/category/$sublink/page/2/'>2</a> rewrite rule in .htaccess: RewriteRule moving-articles/(.*)/(.*)/(.*)/(.*)/$ /moving-articles.php?$1=$2&$3=$4 And piece of php code responsible for calling variables: if(isset($_GET['category']) && isset($_GET['page'])) { $sublink=$_GET['category']; $page=$_GET['page']; ..... } What do i do wrong here? Thanks for your help in advance!
  6. Hi, I got a problem with pagination. I got a script but the problem is that I use the connection to database with "mysqli" NOT "mysql". Im newbe with mysqli and I dont know how can I change the pagination script to work. <?php $dbConnect= mysqli_connect('localhost', 'user', 'password') or die('Cant connect'); mysqli_select_db($dbConnect, 'database') or die('Cant connect to database'); mysqli_set_charset($dbConnect, "utf8"); ?> And this is a script for pagination <?php $limit = 4; $sql = "select count(c_vesti_id) from c_vesti"; $c = array_shift(mysql_fetch_row(mysql_query($sql))); $maxpage = ceil($c / $limit); $page = isset($_GET['page']) ? abs((int)$_GET['page']) : 1; if ($page <= 0) { $page = 1; } else if ($page >= $maxpage) { $page = $maxpage; } $offset = ($page-1) * $limit; $query = mysql_query("select * from c_vesti limit $offset, $limit "); while ($row = mysql_fetch_assoc($query)) { print $row['c_vesti_naslov']."<br />"; } // $linklimit = 4; $linklimit2 = $linklimit / 2; $linkoffset = ($page > $linklimit2) ? $page - $linklimit / 2 : 0; $linkend = $linkoffset+$linklimit; if ($maxpage - $linklimit2 < $page) { $linkoffset = $maxpage - $linklimit; if ($linkoffset < 0) { $linkoffset = 0; } $linkend = $maxpage; } if ($page > 1) { print "<a href='?page=".($page-1)."'>Back</a> "; } for ($i=1+$linkoffset; $i <= $linkend and $i <= $maxpage; $i++) { $style = ($i == $page) ? "color: black;" : "color: blue;"; print "<a href='?page=$i' style='$style'>[$i]</a> "; } if ($page < $maxpage) { print "<a href='?page=".($page+1)."'>Forward</a>"; } ?> Thanks in advanced for help T
  7. Hello, I have problem with my pagination script, I tried to add tags to it but selecting second page (next page) when tag is working and filter content of the page, gets me back to second page with content without tag. It should look like this: gallery/page/2/?s=&tag=2 instead: gallery/page/2 I just dont know what to do. Can you help me out? My pagination script: <?php foreach ($this->pagesInRange as $page): ?> <?php if ($page != $this->current): ?> <li><a href="<?php echo $this->url($this->route, array('page' => $page ), true); ?>"><?php echo $page; ?></a></li> <?php else: ?> <li class="active"><a href="#"><?php echo $page; ?></a></li> <?php endif; ?> <?php endforeach; ?>
  8. Hello, First time asking technical question in a forum so I beg pardon for errors. I have a third party blog module installed on opencart. The original coder helped me to fix some bugs, but he is not answering anymore to emails. I would like to add a simple pagination to the "latest articles" part, because at the moment the website display the exact number declared in "article limit" and does not show pagination if articles shown are less than the total. the code from "article_by_type.php" line 85 is the following: /*recent_article*/ if ($setting['article_type']=='recent_article') { $data = array( 'sort' => 'p.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $article_limit ); $articles = $this->model_news_article->getArticles($data); } another file "article_list.php" at line 88 and 214 already have pagination: $this->data['article_ajax_load'] = $this->getArticle($article_category_id,$page,$limit,$description_limit); $pagination = new Pagination(); $pagination->total = $article_total; $pagination->num_links = 3; $pagination->page = $page; $pagination->limit = $limit; $pagination->text = $this->language->get('text_pagination'); $pagination->url = 'index.php?route=module/article_list/getlist&cpath='.$article_category_id. '&page={page}'.'&limit=' .$limit; $this->data['pagination'] = $pagination->render(); can anyone help add pagination to "article_by_type.php" or adapt the existing pagination code to it ? article_by_type.php article_list.php
  9. So, here goes... On my website, http://jamaica2go.com, I have destinations laid out in thumbnails on the main destination page. The page is using three columns. The page works fine as it is, however, I know that as I add more locations scrolling will become an issue. The author did a great job on this theme and he also gave an option to select maximum number of items to be shown but no paging occurs once you hit that max (weird, right?). I have tried, I really have. Reading up on the WP codex, hunting down scripts and tutorials, all with a view to adding this simple feature. I know if someone figures this out it's going to be easy as cheese but the drawback for me is that I'm not a PHP programmer, just pretty decent at editing and changing the code. Anyway, I'm posting the entire page code below (realised at end that I can attach, so did that instead). The important stuff happens in the "uxbarn_custom_port_load_portfolio_shortcode" function and onward. I noticed that although he starts a while loop to write the thumbnails to the page, he doesn't seem to end it. He also has a pagination template for the blog page which I'll add below but I couldn't make heads or tails of it. Hope someone can assist. PORTFOLIO PAGE ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ The template below is used for blog and search and is called with: <?php get_template_part( 'template-pagination' ); ?> PAGINATION TEMPLATE ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ <?php $big = 999999999; global $wp_query; $total_pages = $wp_query->max_num_pages; if( is_search() ) { // Only for search page, there are 10 posts per page // And always round up the result $total_pages = ceil( $wp_query->found_posts / 10 ); } if ( $total_pages > 1 ) { echo '<div class="row no-margin-bottom"> <div id="blog-pagination" class="uxb-col large-12 columns pagination-centered"> '; $current_page = max( 1, get_query_var( 'paged' ) ); echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '&page=%#%', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => '<i class="icon ion-ios7-arrow-left"></i>', 'next_text' => '<i class="icon ion-ios7-arrow-right"></i>', 'type' => 'list' )); echo '</div> </div>'; } ?> ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ custom-uxbarn-portfolio.php template-pagination.php
  10. Hi all, I created a page template at http://www.durgeshsound.com/gallery/ Here my pagination buttons are not working. this issue arises when permalink format is http://www.example.com/sample-post/ But when I set permalink format to default (www.example.com/?p=123) then it starts to work and creates a working pagination link like this http://www.durgeshsound.com/?page_id=81&paged=2. I want this format http://www.example.com/sample-post/ in the links. Please help.
  11. Hey guys, I'm using the following pagination script from a website I found. I'ts basically a pagination script that takes data from a MySQL database and displays a certain number of sets before placing the next set on a new page. This script works great if I substitute a static value for the data I want returned but If the request is stored in a $POST variable like from an HTML form the data refuses to paginate. It will render the first set of data but will not paginate the rest and only shows blank pages I'm thinking it has something to do with the $POST variable not being set or carrying over to each page but I'm not sure. I truly appreciate the help! <?php /* Place code to connect to your DB here. */ include('config.php'); // include your code to connect to DB. $tbl_name=""; //your table name // How many adjacent pages should be shown on each side? $adjacents = 3; /* 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"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; /* Setup vars for query. */ $targetpage = "filename.php"; //your file name (the name of this file) $limit = 2; //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. */ $sql = "SELECT column_name FROM $tbl_name LIMIT $start, $limit"; $result = mysql_query($sql); /* 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 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page > 1) $pagination.= "<a href=\"$targetpage?page=$prev\">� previous</a>"; else $pagination.= "<span class=\"disabled\">� previous</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?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?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?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?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //close to end; only hide early pages else { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?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?page=$counter\">$counter</a>"; } } } //next button if ($page < $counter - 1) $pagination.= "<a href=\"$targetpage?page=$next\">next �</a>"; else $pagination.= "<span class=\"disabled\">next �</span>"; $pagination.= "</div>\n"; } ?> <?php while($row = mysql_fetch_array($result)) { // Your while loop here } ?> <?=$pagination?>
  12. Hello all, I feel pretty good that I got my AJAX filter working properly. But it still needs some help. Now I am returning the content with Ajax that I want from the search filter of dropdown option (keep in mind there are several options to filter by). But the content returned is often to much to fit on one page - so I need to paginate the successfully returned html from my AJAX call. Here is where I get stumped. Do I setup a normal page nav outside the AJAX area? </div><!-- AJAX return container--> <nav class="pagenav"> <ul id="pag-link"> <li class="old"><?php next_posts_link('« Older Sermons', $sermons_query->max_num_pages) ?></li> <li class="new"><?php previous_posts_link('Newer Sermons »', $sermons_query->max_num_pages) ?></li> </ul> </nav> IF so, how do I update the links info? or do I keep the page nav inside the AJAX area but use some custom code to retrieve the proper link? (I tried using the normal wordpress page nav functions in my php function but they provide the url of the page that the php function is on, not the actual page being viewed). Do I need to make a separate AJAX call to a function that just builds my links? or is there a way to do it with my main call? Here is my AJAX call: //Listen for the menu's to change except the main filter_by dropdown var ids = ['filter_preacher_dropdown', 'filter_sort_by_dropdown', 'filter_per_page_dropdown', 'filter_series_dropdown', 'filter_service_dropdown', 'filter_tag_dropdown', 'filter_book_dropdown', 'filter_year_dropdown']; $('#' + ids.join(',#')).change(function(e) { var pt = [ "preacher","series","service" ]; if($.inArray(this.name, pt)!==-1){ var mk = this.name; var mv = $(this).val(); var ppp = $("#filter_per_page_dropdown").val(); var ob = $("#filter_sort_by_dropdown").val(); var data = { action: 'filter_sermons', meta_key: mk, meta_value: mv, posts_per_page: ppp }; $.post(mbsb_ajaxurl, data, function(response) { $('#sermonlists').fadeOut('slow', function() { $(this).html(response) }).fadeIn('slow'); }); } and here is my php function (slightly paired down for viewing ease): //ajax for sermons filter add_action('wp_ajax_filter_sermons', 'check_ajax'); add_action('wp_ajax_nopriv_filter_sermons', 'check_ajax'); function check_ajax() { global $wpdb, $paged, $max_num_pages; //check if filter is on post_type if($_POST['meta_key']){ $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $mk = '"'.$_POST['meta_key'].'"'; $mv = intval($_POST['meta_value']); $ppp = intval($_POST['posts_per_page']); $offset = ($paged - 1) * $ppp; $sermons = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS sermons.* FROM {$wpdb->prefix}posts AS sermons, {$wpdb->prefix}postmeta WHERE meta_key = {$mk} AND meta_value = {$mv} AND sermons.ID = {$wpdb->prefix}postmeta.post_id LIMIT {$offset}, {$ppp}", OBJECT); $sql_posts_total = $wpdb->get_var( "SELECT FOUND_ROWS();" ); $max_num_pages = ceil($sql_posts_total / $ppp); }elseif($_POST['name']){ //another custom query }elseif ($_POST['book_number']){ //another custom query } $posts = get_posts(); // returns posts in an array if($sermons) { global $post; foreach ($sermons as $post){ setup_postdata($post); //custom query info returned here } //Would the Pagination for the AJAXED content go here? }else{ ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php } die(); }
  13. Hi, I am looking for a tutorial or code sample I can use to learn MySQLi pagination with an option to select items per page, like the attached screenshort. Any help is grately appreciated. Regards. joseph
  14. Hi guys, please help me to solve my problem. i want to get the url parameter using / for now i use index.php?category_id=14 how can i change the ?category_id=14 to index.php/14 thank you so much.
  15. Hi I'm trying to setup Pagination at the bottom of the page after showing 10 images in the following script but have no clue where to start and how to implement it into the script. I also need some help to make a rule where images should show not bigger than 800 x 600 and. Lastly I receive a line showing &nbsp at the bottom of the page and I have no Idea how to remove it... <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html"> <title>Show images in folder</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <br> <?php date_default_timezone_set("Africa/Harare"); $folder = 'img/'; $filetype = '*.*'; $files = glob($folder.$filetype); $count = count($files); $sortedArray = array(); for ($i = 0; $i < $count; $i++) { $sortedArray[date ('YmdHis', filemtime($files[$i])) . $i] = $files[$i]; } ksort($sortedArray); # krsort($sortedArray); echo '<table>'; foreach ($sortedArray as &$filename) { echo '<tr><td>'; echo '<a name="'.$filename.'" <br><img src="'.$filename.'" /></a>'; echo '<br>'; echo substr($filename,strlen($folder),strpos($filename, '.')-strlen($folder)); echo '</td></tr>'; } echo '</table>'; ?>
  16. Regards. I´m trying to use a paginator class in my MVC application The following line of code intent to construct the links to the pages: "<a class=\"paginate\" href=\"$_SERVER[php_SELF]?page=$prev_page&ipp=$this->items_per_page\">« Previous</a> ":"<span class=\"inactive\" href=\"#\">« Previous</span> " The problem is that, perhaps the actual URL is something like this: http://proyectosena.hol.es/Plantilla/vistaPrincipal.php?pg=../vistas/prueba.php, the link constructed appears like this: http://proyectosena.hol.es/Plantilla/&page=2&ipp=25, I've tried with several constructions of links using various of the options of the $_SERVER variable, but ever I get the same result. The application´s main frame is a file with three includes files and this is the code: <!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" /> <title>empresa ADSI - VIRTUAL</title> <link rel="stylesheet" type="text/css" href="../css/actividades.css" /> <link rel="stylesheet" type="text/css" href="../css/jtable.css" /> </head> <body> <div id="divContenedor"> <?php include "../Plantilla/encabezado.php";?> <div id="contentwrap"> <?php include "../Plantilla/".$pg; ?> </div> <div> <?php include "../Plantilla/piePagina.php";?></div> </div> </body> </html> Paginator.php prueba.php vistaPrincipal.php
  17. The issue I am having is that everytime I click the next button, it takes me to the index page. My question is, how do I set up a proper search results link in "href="?page=1" index.php <form action="search" method="GET"> <input type="search" name="search" placeholder="Find products, services ..."> <input type="submit" name="submit" value=""> </form> search.php if(isset($_GET['submit']) && !empty($_GET['search'])) { $value = escape(trim(Input::get('search'))); try { // Find out how many items are in the table $q = DB::getInstance()->query("SELECT * FROM records WHERE MATCH(title) AGAINST('$value' IN BOOLEAN MODE)"); $total = $q->count(); // How many items to list per page $limit = 10; // How many pages will there be $pages = ceil($total / $limit); // What page are we currently on? $page = min($pages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array( 'options' => array( 'default' => 1, 'min_range' => 1, ), ))); // Calculate the offset for the query $offset = ($page - 1) * $limit; // Some information to display to the user $start = $offset + 1; $end = min(($offset + $limit), $total); // Prepare the paged query $stmt = DB::getInstance()->query("SELECT users.*, records.* FROM records LEFT JOIN users ON records.user_id = users.user_id WHERE MATCH(title) AGAINST('$value' IN BOOLEAN MODE) ORDER BY relevance DESC LIMIT {$limit} OFFSET ".$offset); if($stmt->count()) { // Display the results foreach($stmt->results() as $row) { $date = escape($row->posted); $record_date = escape(Input::facebook_date_format($date)); $record_id = escape($row->record_id); $title = trim($row->title); $slug_title = $row->slug_title; $view_count = escape(intval(number_format($row->views + 1))); $username = escape($row->username); require 'snippets/record_widget.php'; } } else { ?><div class="message"><?php echo 'No records found.';?></div><?php } <?php // The "back" link $prevlink = ($page > 1) ? '<a href="?page=1" title="First page"><img src="images/left-page-arrow-end.png"/></a> <a href="?page=' . ($page - 1) . '" title="Previous page"><img src="images/left-page-arrow-start.png"/></a>' : '<span class="disabled"><img src="images/left-page-arrow-end-disabled.png"/></span> <span class="disabled"><img src="images/left-page-arrow-start-disabled.png"/></span>'; // The "forward" link $nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page"><img src="images/right-page-arrow-start.png"/></a> <a href="?page=' . $pages . '" title="Last page"><img src="images/right-page-arrow-end.png"/></a>' : '<span class="disabled"><img src="images/right-page-arrow-start-disabled.png"/></span> <span class="disabled"><img src="images/right-page-arrow-end-disabled.png"/></a></span>'; // Display the paging information ?> <div class="pages"> <span class="pages-arrows"><?php echo $prevlink; ?></span> <span class="pages-numbers"><?php echo $page; ?> of <?php echo $pages; ?></span> <span class="pages-arrows"><?php echo $nextlink; ?></span> </div> } catch (Exception $e) { echo '<p>', $e->getMessage(), '</p>'; } } else { Redirect::to('index'); }
  18. Hi, Can any one help me wit the pagination in android mobile App Pls find the attached file for full code As per the below coe it displays only 40 posts but i have around 500 posts. I can increse function add_query_vars($public_query_vars) { $public_query_vars[] = $this->namespace.'_p'; return $public_query_vars; } $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'category__in' => $categories, ); if ($wp->query_vars[$this->namespace.'_p'] == 1){ $args['posts_per_page'] = 10; $args['offset'] = 0; }else{ $args['posts_per_page'] = 40; $args['offset'] = 10; } $posts = get_posts($args); I have tried but i am getting only 210 posts.only if i increse the post_per_page more than 70 in mobile android app it shows loding $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'category__in' => $categories ); if ($wp->query_vars[$this->namespace.'_p'] == 1){ $args['posts_per_page'] = 70; $args['offset'] = 0; } if ($wp->query_vars[$this->namespace.'_p'] == 2){ $args['posts_per_page'] = 140; $args['offset'] = 70; } if ($wp->query_vars[$this->namespace.'_p'] == 3){ $args['posts_per_page'] = 210; $args['offset'] = 140; } $posts = get_posts($args); wp-app-maker.php
  19. Hi Guys and Girls, I'm having a bit of a hard time getting some pagination working. I have a script using CURL getting JSON results via a HTTP API. This is also used in a Wordpress Installation. The API call has a maximum of 50 records returned but allows pagination. What I can't seem to get right is actually getting this to work. Below is the code that I'm using: <?php //functions relating to wordpress go here: //---------------------------------------- $bg_colors = array('green', 'orange', 'blue', 'yellow', 'red', 'black'); //---------------------------------------- //End functions relating to wordpress // Start PetRescue PHP/API Code //---------------------------------------- // Open CuRL/JSON Stuff $ch = curl_init(); $category=$_GET['category']; $url="http://www.xxx.com.au/api/listings?token=xxxtokenxxx&group_id=xxx&species=".$category; curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: application/json', 'X-some-API-Key: xxxtokenxxx', )); $json = json_decode(curl_exec($ch), true); //Pagination stuffs if($_GET['page']) { $page=substr($_GET['page'],1); echo 'page'.$page; } // Functions relating to the Echo Code foreach($json['listings'] as $listing) { $short_personality=substr($listing['personality'],0,500); $peturl="http://xxx.org.au/pet-info/?petid=".$listing['id']; $medium_photo=$listing['photos'][0]['large_340']; $gallery_first=$listing['photos'][0]['xlarge_900']; $gender_class=strtolower($listing['gender']); $breed_class=strtolower($listing['species']); $name=($listing['name']); $unique_gallery_name="lightbox['.$inc.']"; $inc++; foreach($listing['photos'] as $photosthumb) { $photo_thumb_large=$photosthumb["xlarge_900"]; $photo_thumb_hidden=$photosthumb["xlarge_340"]; } $rand_background = $bg_colors[array_rand($bg_colors)]; // General IF/AND/ELSE Statements to refine the Echo Output if($listing['photos'] == null) { $medium_photo="http://xxx.org.au/wp-content/themes/xxx/images/photo_coming_soon.png"; } if($listing['desexed'] == "Yes") { $desexed="yes"; } else { $desexed="no"; } if($listing['vaccinated'] == "Yes") { $vaccinated="yes"; } else { $vaccinated="no"; } if($listing['wormed'] == "Yes") { $wormed="yes"; } elseif($listing['wormed'] == "No") { $wormed="no"; } else { $wormed="no"; } if($listing['heart_worm_treated'] == "Yes") { $heart_worm_tested="yes"; } elseif($listing['heart_worm_treated'] == "No") { $heart_worm_tested="no"; } else { $heart_worm_tested="no"; } if($listing['species'] == "Dog") { $adoption_enquiry_link="http://xxx.org.au/pre-adoption-form-dogs/?dog_name=$name"; $hwt="list-$heart_worm_tested"; } elseif($listing['species'] == "Cat") { $adoption_enquiry_link="http://xxx.org.au/pre-adoption-form-cats/?cat_name=$name"; $hwt="list-hwt-hidden"; } // Echo the output echo'<div class="animal"> <div class="animal-image"> <a class="size-thumbnail thickbox" rel="'.$unique_gallery_name.'" href="'.$gallery_first.'"> <img src="'.$medium_photo.'" class="image-with-border" alt=""> <div class="border" style="width: 340px; height: 340px;"> <div class="open"></div> </div> </a> <div class="item-title-bg '.$rand_background.'"> <h2 class="entry-title"> '.$listing['name'].'</h2> <div class="animal-adopt-button"> <a href="'.$adoption_enquiry_link.'" style="background-color: #575757; border-color: #494949; background-position:5px 0;" class="button medium"> Enquire about '.$name.'</a> </div> </div> </div> <div class="animal-thumbnail hidden"> <a class="lightbox" rel="'.$unique_gallery_name.'" href="'.$photo_thumb_large.'"> <img class="animal-thumbnail" src="'.$photo_thumb_hidden.'" > </a> </div> <div class="animal-content"> <div class="animal-left"> <ul class="animal-list"> <li class="list-sex-'.$gender_class.'">'.$listing['gender'].'</li> <li class="list-breed-'.$breed_class.'">'.$listing['breeds_display'].'</li> <li class="list-age">'.$listing['age'].'</li> <li class="list-fee">'.$listing['adoption_fee'].'</li> </ul> </div> <div class="animal-right"> <ul class="animal-list"> <li class="list-'.$desexed.'">Desexed?</li> <li class="list-'.$vaccinated.'">Vaccinated?</li> <li class="list-'.$wormed.'">Wormed?</li> <li class="'.$hwt.'">Heart Worm Tested?</li> </ul> </div> <div class="animal-full"> <ul class="animal-list"> <li class="list-description">'.$listing['personality'].'</li> </ul> </div></div> <div class="clearer"></div> </div> <div class="delimiter"></div>'; // Close the CURL } echo' <div class="pagination footer-pagination"> <nav class="pagination"> <div class="pages">'; for($i=1;$i<=$json['total_pages'];$i++) { $this_page=substr($_GET['page'],1); $active=""; if($i==$this_page) { $active="active"; } echo ' <span class="page'. $active.'"> <span class="number"> <a rel="prev" href="http://xxx.org.au/pet/?category=dog&page='.$i.'"> '.$i.'</a> </span> </span> </div> </nav> </div>'; curl_close($ch); } ?> This is a sample of the JSON results: {"listings":[{"adoption_fee":"$200 ","adoption_process":"For cats, please fill out our <a href=\"http://xxx.org.au/pre-adoption-form-cats/\">Pre-Adoption Questionnaire - Cats</a>.\r\n\r\nFor dogs, please fill out our <a href=\"http://xxx.org.au/pre-adoption-form-dogs/\">Pre-Adoption Questionnaire - Dogs</a>.\r\n\r\nFor more information on our Adoption Process, please visit this <a href=\"http://xxx.au/our-adoption-process/\">link</a>.\r\n\r\nPlease make sure that you are familiar with our <a href=\"http://xxx.org.au/adoption-agreement/\">Adoption Agreement</a> as it has recently changed.\r\n\r\nFor more information on any of our animals, please <a href=\"http://xxx.org.au/contact-us/\">Contact Us</a>.","age":"2 years 5 months","breeds":["Domestic Long Hair"],"breeds_display":"Domestic Long Hair","coat":"Long","contact_name":null,"contact_number":null,"contact_preferred_method":"Email","created_at":"30/1/2014 21:36","date_of_birth":"20/2/2012","desexed":true,"foster_needed":false,"gender":"Female","group":"xxx","heart_worm_treated":null,"id":273191,"interstate":false,"last_updated":"5/8/2014 12:20","medical_notes":"","microchip_number":"","mix":false,"multiple_animals":false,"name":"Helena HC13-394","personality":"Stunning Helena!\r\n\r\nThis beautiful girl is looking for a home that is fairly relaxed. She is not happy about sharing her current foster home with some bossy cats, she likes to be the princess of her realm.\r\n\r\nShe is very affectionate, and when it is quiet she will come and have a big smooch around our legs, and purr her pretty little purr. \r\n\r\nShe is somewhat timid to start with, but enjoys the company of people and once she trusts, she's a very special companion.\r\n\r\n","photos":[{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_70x70.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_130x130.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_340x340.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_cb61a_900x900.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_70x70.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_130x130.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_340x340.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_7a7a7_900x900.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_70x70.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_130x130.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_340x340.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/1/30/273191_8b90b_900x900.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_70x70_96020.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_130x130_96020.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_340x340_96020.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_691df_900x900_96020.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_70x70_d2d41.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_130x130_d2d41.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_340x340_d2d41.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/4/26/273191_6d9da_900x900_d2d41.jpg"},{"small_80":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_70x70_982c6.jpg","medium_130":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_130x130_982c6.jpg","large_340":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_340x340_982c6.jpg","xlarge_900":"http://xxx.com.au/uploads/pet_photos/2014/7/12/273191_f209f_900x900_982c6.jpg"}],"senior":false,"size":null,"species":"Cat","state":"WA","vaccinated":"Yes","wormed":"Yes"}, And the pagination details are at the bottom of the JSON response: "page":"1","per_page":"50","total_pages":"6" The issue I get with all of this, is when calling the PHP file again, it's just returning the first page of results and not the second page. Any help would stop me from eating my own eyeballs, as I've been staring at this for hours! Cheers, Dave
  20. I am trying to add a simple pagination to my page. I know there are tons of tutorials out there for this. Well I have taken one of them and used my own queries with it. Below is the code. The records do show up. The only problem is that all the records(from mysql table) show up, as oppose to limiting them per page. Can you take a look at it and tell me what I might be doing wrong? try { // Find out how many items are in the table $total = DB::getInstance()->query("SELECT COUNT(*) FROM records"); // How many items to list per page $limit = 20; // How many pages will there be $pages = ceil($total / $limit); // What page are we currently on? $page = min($pages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array( 'options' => array( 'default' => 1, 'min_range' => 1, ), ))); // Calculate the offset for the query $offset = ($page - 1) * $limit; // Some information to display to the user $start = $offset + 1; $end = min(($offset + $limit), $total); // Prepare the paged query $stmt = DB::getInstance()->query("SELECT images.*, records.* FROM records LEFT JOIN images ON records.user_id = images.user_id ORDER BY record_id LIMIT {$limit} OFFSET {$offset}"); if($stmt->count()) { // Display the results foreach($stmt->results() as $row) { $thumb_img = escape($row->thumb_path); $title = trim($row->title); ?> <div class="item"> <?php echo $thumb_img; ?> <?php echo $title; ?> </div> <?php } } else { echo '<p>No results could be displayed.</p>'; } // The "back" link $prevlink = ($page > 1) ? '<a href="?page=1" title="First page">«</a> <a href="?page=' . ($page - 1) . '" title="Previous page">‹</a>' : '<span class="disabled">«</span> <span class="disabled">‹</span>'; // The "forward" link $nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page">›</a> <a href="?page=' . $pages . '" title="Last page">»</a>' : '<span class="disabled">›</span> <span class="disabled">»</span>'; // Display the paging information echo '<div id="paging"><p>', $prevlink, ' Page ', $page, ' of ', $pages, ' pages, displaying ', $start, '-', $end, ' of ', $total, ' results ', $nextlink, ' </p></div>'; } catch (Exception $e) { echo '<p>', $e->getMessage(), '</p>'; } ?>
  21. Hey guys, i was wondering if any1 cud help me. I have a database search engine that I'm currently working on, everything seems to be working fine locally including pagination but as soon as i upload the site online, the pagination doesn't work properly. when you use the search bar the results on the first page are correct, but as soon as you click next or page 2 it automatically returns wrong data. how can i fix this since it works fine locally???
  22. Hey Guys & Girls, Okay, so here's my little issue. I'm running a WordPress site with a custom PHP script using JSON/CURL/API pulling info from an API. All is good in the world in this respect. However, the API listings that are returned are only returned in a 50 item block. The API doesn't allow for more than 50 items per call. So, what I'm looking for is a way to paginate my results so that if there are more than 50 items in the API call, it will allow the user to click to page 2, 3, 4 etc. Here's my code: <?php //functions relating to wordpress go here: //---------------------------------------- $bg_colors = array('green', 'orange', 'blue', 'yellow', 'red', 'black'); //---------------------------------------- //End functions relating to wordpress // Start PetRescue PHP/API Code //---------------------------------------- // Open CuRL/JSON Stuff $ch = curl_init(); $category=$_GET['category']; $url="http://www.myapilink.com.au/api/listings?token=f716909f5d644fe3702be5c7895aa34e&group_id=10046&species=".$category; curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: application/json', 'X-some-API-Key: f716909f5d644fe3702be5c7895aa34e', )); $json = json_decode(curl_exec($ch), true); // Functions relating to the Echo Code foreach($json['listings'] as $listing) { $short_personality=substr($listing['personality'],0,500); $peturl="http://mysiteurl.com.au/beta/pet-info/?petid=".$listing['id']; $medium_photo=$listing['photos'][0]['large_340']; $gallery_listing=$listing['photos'][5]['large_900']; $gender_class=strtolower($listing['gender']); $breed_class=strtolower($listing['species']); $name=($listing['name']); $unique_gallery_name="lightbox['.$inc.']"; $inc++; foreach($listing["photos"] as $photosthumb) { $photo_thumb_large=$photosthumb["large_340"]; $photo_thumb_hidden=$photosthumb["small_80"]; } $rand_background = $bg_colors[array_rand($bg_colors)]; // General IF/AND/ELSE Statements to refine the Echo Output if($listing['photos'] == null) { $medium_photo="http://mysiteurl.com.au/beta/wp-content/themes/Archive/images/photo_coming_soon.png"; } if($listing['desexed'] == "Yes") { $desexed="yes"; } else { $desexed="no"; } if($listing['vaccinated'] == "Yes") { $vaccinated="yes"; } else { $vaccinated="no"; } if($listing['wormed'] == "Yes") { $wormed="yes"; } elseif($listing['wormed'] == "No") { $wormed="no"; } else { $wormed="no"; } if($listing['heart_worm_treated'] == "Yes") { $heart_worm_tested="yes"; } elseif($listing['heart_worm_treated'] == "No") { $heart_worm_tested="no"; } else { $heart_worm_tested="no"; } if($listing['species'] == "Dog") { $adoption_enquiry_link="http://mysiteurl.com.au/beta/pre-adoption-form-dogs/?dog_name=$name"; $hwt="list-$heart_worm_tested"; } elseif($listing['species'] == "Cat") { $adoption_enquiry_link="http://mysiteurl.com.au/beta/pre-adoption-form-cats/?cat_name=$name"; $hwt="list-hwt-hidden"; } // Echo the output echo'<div class="animal"> <div class="animal-image"> <a class="size-thumbnail thickbox" rel="'.$unique_gallery_name.'" href="'.$medium_photo.'"> <img src="'.$medium_photo.'" class="image-with-border" alt=""> <div class="border" style="width: 340px; height: 340px;"> <div class="open"></div> </div> </a> <div class="item-title-bg '.$rand_background.'"> <h2 class="entry-title">'.$listing['name'].'</h2> <div class="animal-adopt-button"> <a href="'.$adoption_enquiry_link.'" style="background-color: #575757; border-color: #494949; background-position:5px 0;" class="button medium">Enquire about '.$name.'</a> </div> </div> </div> <div class="animal-thumbnail hidden"> <a class="lightbox" rel="'.$unique_gallery_name.'" href="'.$photo_thumb_large.'"> <img class="animal-thumbnail" src="'.$photo_thumb_hidden.'" > </a> </div> <div class="animal-content"> <div class="animal-left"> <ul class="animal-list"> <li class="list-sex-'.$gender_class.'">'.$listing['gender'].'</li> <li class="list-breed-'.$breed_class.'">'.$listing['breeds_display'].'</li> <li class="list-age">'.$listing['age'].'</li> <li class="list-fee">'.$listing['adoption_fee'].'</li> </ul> </div> <div class="animal-right"> <ul class="animal-list"> <li class="list-'.$desexed.'">Desexed?</li> <li class="list-'.$vaccinated.'">Vaccinated?</li> <li class="list-'.$wormed.'">Wormed?</li> <li class="'.$hwt.'">Heart Worm Tested?</li> </ul> </div> <div class="animal-full"> <ul class="animal-list"> <li class="list-description">'.$listing['personality'].'</li> </ul> </div></div> <div class="clearer"></div> </div> <div class="delimiter"></div>'; // Close the CURL } curl_close($ch); ?> Attached is some dummy data that represents the JSON data returned from the API. As you can see in the file, the last line is where the paging details comes in. Any help you guys could give would be appreciated. Cheers, Dave listings.txt
  23. need php,ajax auto scroll pagination for the website www.unitedwebsoft.in .Current site is in PHP and also some section in Drupa CMS.
  24. Hello, i need to change the display url in the browser with httaccess This is the link in the browser: fun.php?search=&submit=search&page=1 And i want to change in to this fun/page/1 This is what i try to do, I created a .httacces file in public html with this text in it. RewriteEngine On # Rewrite all php files RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [L] # Rewrite blog pagination RewriteRule ^fun/page/([a-zA-Z_-]+)/([0-9]?) fun.php?search=&submit=search&page=$1 [L,QSA] But it doenst work. Thanks in advance for any help.
  25. Okay so i have a file that i need some php variables from. This is the code that i am using. please help ! This is the ajax that i am trying to use to get the variable and then set it to a php variable. $.ajax({ url : 'pagination_data.php?page=1', type : 'POST', data : data, dataType : 'json', success : function (result) { var k=result; <?php $next ?>=var k; }, error : function () { alert("error"); } }); Now here i am setting the varialbes in the other file. $next = $page+1; $prev = $page-1; echo json_encode($next); echo json_encode($prev); and this is where i need the variables... <?php echo "<div class='controls' id='$prev'></div><div class='controls' id='$next'>"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.