Pagination with 10 pages - 5 either side

Hi all,
I'm trying to get some pagination to my results page.
I would like the navigation links to only show 5 pages on either side of the current page.
For example if I have 40 pages in total:
Page 1 shows:
*1* _2_ _3_ _4_ _5_ _6_ _7_ _8_ _9_ _10_ [_Last_] Next
Page 18 shows:
[_First_] _14_ _15_ _16_ _17_ *18* _19_ _20_ _21_ _22_ _23_ [_Last_] Next
Currently I have all the page links (1-40 echoed) by using this tutorial:
http://www.phpbuilder.com/tips/item.php?id=2
Hope someone can help as I'm completed stumped!

If my very quick scan of the article was correct you'll need to change the loop start and end values in this part of the code:
// Now loop through the pages to create numbered links
// ex. 1 2 3 4 5 NEXT >>
for ($i=1;$i<=$pages;$i++) {
     // Check if on current page
     if (($offset/$limit) == ($i-1)) { Change the loop bounds 1 and $pages. You'll need to do some maths to work out the current page number, and then add and subtract 5 for the start and end. Make sure not to go past the start or end of the set of pages. Good luck.

Similar Messages

  • Since last weekend (3-15-15) I have been unable to send/receive text messages with a friend who has Sprint service. The messages send with no errors on either side, but neither side is receiving the messages. Is anyone else having any similar issues?

    Since last weekend (3-15-15) I have been unable to send/receive text messages with a friend who has Sprint service. The messages send with no errors on either side, but neither side is receiving the messages. It seems to be only this one person affected by this issue, everyone else that I've tried sending messages to has responded with no trouble. Is anyone else having any similar issues?

    Retrohacker, Your text messages are too important to be missed! Let's figure this out, together. Are you able to successfully make and receive calls from your friend? Which phone do you have with us? Any new messaging applications or changes that you can recall on the phone since this issue began? Please share details so we can get to the bottom of this for you.  TanishaS1_VZW Follow us on Twitter @VZWSupport  If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • I've just changed computers and now some websites (mainly facebook) only appear in the centre of the screen with a white band either side.

    Since changing my computer some web pages are only showing text, picture etc down the centre of the screen, this one included. Increasing the text size with zoom or changing to full screen do not resolve the problem. A better explanation might be that text does not fill the screen right to left there is a wide margin either side.

    Hi
    Thanks for the reply, I have tried all these steps and it doesn't solve the problem. I don't know whether I am explaining it properly. It's not making the sites illegible it's just really annoying. The site content is only displayed down the middle of the screen with the first quarter and last quarter being blank, I fear it may be one of those things I have to live with. It's just weird because I have never had this before on my old computer. It won't let me add a screen shot which would probably make it clear what I mean.
    Thanks again

  • HT4623 iTunes but it comes up with a page to either login or subscribe again

    I have subscribed to the Advertiser and received conformation from iTunes but it up up with a peg to either login or subscribe again once the paper loads

    Try here:
    iTunes for Windows: "Unable to load data class" or "Unable to load provider data" sync services alert
    If not successful see the previous discussion on the right side of this page with the green checkmark.

  • Mozilla, facebook and other sites. content of page is centered with blank borders on either side.

    various web pages(mozilla.com, facebook) appear as follows. web content is centered in middle of browser page leaving a large blank border on each side. background graphics take up whole browser window, but not content.
    == This happened ==
    Every time Firefox opened
    == i just got a new tower. downloaded fresh mozilla.

    Hi Hindhaughlee, <br />Thanks for the post.
    This may not be the best place to post such a solution but maybe some users will find it. If it turns out to be a major problem with a simple solution maybe we will manage to document it somewhere.
    Are you able to provide more details please:
    * exactly what software and software versions is the problem with ? <br /> You appear to be a Windows 8 user, but presumably the Kaspersky software may be applicable to other Windows versions, which Kaspersky software is this tested with ?
    * What is he exact error message or warning that Kaspersky generates in this situation ?
    * is the problem documented elsewhere, preferably in a public open site, if so maybe you could provide a link
    * can you detail simple but exact detailed Steps To Reproduce that will enable others to test out this problem and solution.
    Cheers
    John <br /> <sub>One of the forum moderators J99<sub>
    P.S. <br />
    Anyone with this problem finding that the solution works may wish to vote for this thread and solution. Or if someone else can produce links to examples of this or you are able to give precise Steps To Reproduce please add a post of your own.

  • Pagination with Double page spreads?

    Having a little issue; Normally I do my page numbers manually (insane I Know, but I usually do very small books so it doesn't matter too much), but I am working on a very large book and doing it manually is out of the question.
    I am inserting a Special Character textbox,to start from page 3, however , I have designed each A4 page in InDesign to be 2 pages in the book format (so A5 book pages). I want InDesign to realise this but I am having trouble. I have tried pasting my automatic pagination textbox (Even trying to set it to 'Display previous page') but it is not having it.
    How Can I work around this. I've attached an image incase this doesn't make sense (which i'm sure it won't! )
    Here's a link to the pic: You can see that my A4 InDesign Pages have 2 A5 pages fitted on, but InDesign sees it as the same page # (understandably). I need one of them to display 'PREVIOUS PAGE'. So I can paste in place on every page.
    Mirror'd link:
    http://imgur.com/mSPZV
    Hope you can help, thanks!

    You would work around this by not doing that way.
    InDesign doesn't work for this; the usual way to get "double page spreads" is to make single pages. That's why there is a checkbox "Facing Pages" in the New Document dialog -- pages are viewed as they will be printed, and still they are separate.
    Unfortunately, your current way of working is so off course that there is no easy way to "convert" your spreads to regular pages. It might be less work to bite the bullet, accept the consequences of Not Looking Ahead, and number (once again) by hand.

  • When I create a new chapter sometimes I get the chapter number with bullets on either side and sometimes I don't. I want to be constant. How do I consistently create bullets on both sides of the Chapter Number?

    How do I create bullets on both sides of the Chapter Number?  eg. Chapter One with bullets on either side.

    K T
    I originally started with a template but just erased all the content and built the book using blank pages. Sometimes when I add a chapter it comes up  like the example below or it could come up without the bullets. For the life of me, I don't understand why.
    Van Hunter
    • Chapter Eight •    

  • When I open pages it scrolls through various numbers of blank pages with a line at the side, then stops at a document, but usually an old document. I have to  go to "open recent" to get on the page I want.

    Hi
    When I open Pages it scrolls through numerouss blank pages with a line at the side 1st, then settles on an old saved pages document.I then have to go to "open recent" to select the one I want. Why?

    No
    It's the 1st version of Pages I've had on my computer.
    Can't delete them as they scroll through them at a rapid pace. The longer I've had the problem the more blank pages it scrolls through.

  • Hello, I have a problem with my mac book pro after running the battery dead on a game.  The display has shrunk leaving two black margins on either side. What to do ?

    Hello, I have a problem with my mac book pro after running the battery dead on a game.  The display has shrunk leaving two black margins on either side. What to do ?

    Go to System Preferences>Displays and set the resolution to "Best for this computer" (or something to that effect).
    Clinton

  • Which keys do I have to press for pagination shortcut in pages?

    Hi,
    I'd like to use the shortcut for pagination shown in pages. It looks like this:
    Can you tell me which key that is?
    Best
    Sarah

    No, I'm not talking about iTunes.  The music icon is orange with a dark brown series of notes.  It should be in thel lower right side of your home screen.
    If it's not there, you might try Settings > General > Reset > Reset home screen layout.

  • Searching 2 years either side of a date field?

    Hi
    In my query I would like the search to be able to search 2 years either side of a specified search date in my interactive report
    select
    ROWID,
    ID,
    COLUMN1,
    COLUMN2,
    TO_CHAR(INDDOB, 'YYYY') AS NEWYEAR
    from TABLENAME
    ORDER BY INDDOB asc
    The interactive report is also using custom Javascript to offer an autocomplete search as per this thread For VC - Using multiple Autocomplete on a page?
    So I am unsure how this would work by allowing the date results to include 2 years either side of the chosen date?

    Mike many thanks for this
    INDDOB is a date field in the DB and the item name is :YEARD
    Using the following WHERE clause and a default vale of 1930 in the :YEARD item name is returning the correct result i.e. 1930 plus records from 1928,1929,1931 and 1932
    select
    ROWID,
    ID,
    INDSUB,
    INDDOD,
    INDREG,
    INDENT,
    INDDOD,
    INITCAP(INDSNAME) indsname,
    INITCAP(INDFNAME) INDFNAME,
    TO_CHAR(INDDOD, 'YYYY') AS NEWYEAR,
    DELDOC from   RAMBO.TABLENAME
    WHERE to_char(INDDOD,'YYYY') between :YEARD -2 and :YEARD +2
    ORDER BY INDDOD asc
    The problem is however when I try and change the search value in :YEARD from the default 1930 to for example 1950 (which is also in the db)
    When doing this it brings back no results? Could it be something to do with the associated code below which provides an autocomplete feature and search of the IA report as you type in the field name.
    In the :YEARD item under label and HTML table Cell attributes has the following
    onkeydown="if($f_Enter(event)){srch3($v('YEARD')); return false;}"
    and under the list of values in the definition for :YEARD is
    select distinct TO_CHAR(INDDOD, 'YYYY') from RAMBO.TABLENAME order by 1
    Also under page and Javascript is the following
    function srch2(pItem, pColumn) {  
       $.post('wwv_flow.show',
              {"p_request"          : 'APXWGT',
              "p_widget_action"     : 'FILTER',
              "p_widget_action_mod" : 'ADD',
              "p_widget_mod"        : 'ACTION',
              "p_widget_name"       : 'worksheet',
              "p_flow_id"           : $v('pFlowId'),
              "p_flow_step_id"      : $v('pFlowStepId'),
              "p_instance"          : $v('pInstance'),
              "x01"                 : $v('apexir_WORKSHEET_ID'),
              "x02"                 : $v('apexir_REPORT_ID'),
              "x03"                 : pColumn,
              "f01"                 : ['COLUMN', pColumn, '=', $v(pItem), null, 'minutes']
             function(data){
                //when the filter has been successfully applied the report has to be refreshed
                if(data=="true"){
                   gReport.pull();
       //clear the item
       $s(pItem,'');
    $(document).ready(function(){
       //hide IR toolbar
       $('#apexir_TOOLBAR').hide();
       $('#P4_AC').bind("result", function(){   
          //on selecting a value then fire the search function
          srch2(this, 'INDSNAME');
       // ac item P4_AC2
       $('#P4_AC2').bind("result", function(){   
          srch2(this, 'INDFNAME');
       // ac item YEARD
       $('#YEARD').bind("result", function(){
          srch2(this, 'NEWYEAR');
    // ac item REG
       $('#REG').bind("result", function(){
          srch2(this, 'INDREG');
    // ac item ENTNO
       $('#ENTNO').bind("result", function(){
          srch2(this, 'INDENT');

  • Some files in "DOCUMENTS" icon in dock won't open. Get msg saying You need a newer version of Pages to open this document." Have Pages 4.1 installed.  Same files will open ok from Finder, Pages App. Recently sync'd with ipad2 (Pages) after iOS5 installed.

    Some files in "DOCUMENTS" icon in dock won't open. Get msg saying "You need a newer version of Pages to open this document." Already have Pages 4.1 installed.  Same files will open ok from Finder/Pages App./selected file. Prob not noted until recently after sync'd with ipad2 (Pages) when I installed iOS5. Anyone-- please?!

    You have 2 versions of Pages on your Mac.
    Pages 5.2 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5.2 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Older versions of Pages 5 can not open files from later versions of Pages 5.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud and opened in a newer version of Pages is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has removed almost 100 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Rate/review Pages 5.2 in the App Store.
    Peter

  • How can I print a file with mixed page orientation in windows 8.1?

    I have a win 7 and a win 8.1 computer.  I have a file which contains both landscape and portrait pages.  The file prints correctly with the mixed orientation from the win 7 pc, but will only print with either landscape or portrait on the win 8.1 pc. 
    I am using Adobe reader XI on the win 7 pc and adobe touch on the win 8.1 pc

    ส่งจาก จดหมายของ Windows
    จาก: Pat Willener
    ส่งเมื่อ: จ. 5 มกราคม 2558 6:15
    ถึง: thang dinhvan
    How can I print a file with mixed page orientation in windows 8.1?
    reply from Pat Willener in Adobe Reader Touch for Windows 8 - View the full discussion 
    I have a win 7 and a win 8.1 computer.  I have a file which contains both landscape and portrait pages.  The file prints correctly with the mixed orientation from the win 7 pc, but will only print with either landscape or portrait on the win 8.1 pc. 
    I am using Adobe reader XI on the win 7 pc and adobe touch on the win 8.1 pc
    If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7064031#7064031 and clicking ‘Correct’ below the answer
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7064031#7064031
    To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"
    Start a new discussion in Adobe Reader Touch for Windows 8 by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • Please help me, I'd need to create XForms binding-exception with XHTML page

    Hello,
    is anyone here who could help me?
    I've spent plenty of hours by searching the correct and suitable way for creating a binding exception in XForms, but I did not succeed...
    My situation is: I've got an XHTML page with XForms and XML (input) file, which describes this page. Whenewer I change the input data in the XML file (for example if there are tags <person> and ....</person> if I change it to <peson1> and ...</person1>) after saving the changes and refreshing the page, the XForms are changed (for example some text fields are missing or they've got white background instead red one, which there was before et cetera). {I hope it is clear till now.....}
    My task is: to create a xforms-binding-expression event, which will display an error message (for example: FILE HAVE BEEN CHANGED, CAN NOT DISPLAY THE PAGE PROPERLY) to the user.
    i've found some stuff, how to create such message, but i need to know the exact order of commands to make it work, where to insert them, the structure etc, so I can comprehend your advices...
    The XHTML file contains of several blocks - bind, model, submission, instance etc - and I do not actually know, where to insert such lines (with message)...I think I should make some bindings with the page loading, but I've got no idea how to get it done, however there are very few sites with such stuff on the internet. I hope this task is no big deal for you gyus, THANK YOU A LOT IN ADVANCE

    Thanks a lot.
    Yes. It works well now.
    In it's documentation it says put orcl for SID but never thought to try default xe.
    You're the man.
    tnx

  • Aspect ratio: 4:3 material being exported with black bars (on the sides!)

    Hi all
    I'm fairly new to using FinalCut Express: previously I've used other non-linear video editors on Windows.
    I'm having a bit of a weird problem: I've got a sequence which was shot entirely in 4:3 (PAL). However, when I try to export that to a QuickTime movie it appears squashed from either side — black bars appear at the sides of the frame and everyone looks very tall and thin. The frame itself is still 4:3 but everything is being squashed to fit in the bars.
    I've fiddled with as many settings as are immediately obvious to me to see if I can rectify this, but so far no banana: the sequence is about 90 minutes long and takes about 30 minutes to render each time when exporting.
    Has anyone got any ideas what to do about this? I've been trying to do some research into how FCP/FCE handle different aspect ratios, and it seems to be a very complicated topic. In fact, in the same project I've got a sequence which contains almost entirely 16:9 anamorphic material. Ideally I'd like this to be output in a 16:9 frame with the few 4:3 clips appearing with bars on the side. However, it's only being output as 4:3 where the 4:3 clips appear full-frame and the 16:9 clips have bars at top and bottom...
    Hope someone can help!
    Mac Pro: 3GHz, 6GB RAM, X1900XT, BT, AirPort   Mac OS X (10.4.8)  

    Tom, thanks for the reply.
    Everything looks absolutely fine when played back in FCE; it's only when exporting to QuickTime that my problems start. The point is that this 4:3 sequence isn't being output into a 16:9 frame as a pillarbox: what's actually happening is that it's being put into a 4:3 frame with bars, with the result that the content is in fact being squeezed (it looks wrong).
    How can you modify the aspect-ratio settings for a given sequence? I've looked through all the obvious sequence properties settings but have never found anything.
    I'll just reiterate — it plays back fine within the viewer; only when output does it all go awry.
    Richard

Maybe you are looking for

  • MGR-11401 error in ORACLE 7.3.4 servers

    Hi All, I want to run a shell script connecting to oracle database and redirect the output to a file. Please find the command i am using and the error received. Kindly suggest me an alternate or correct the same. GMX-/home/oracle/health: svrmgrl @dbh

  • Apache HTTP server and Tomcat integration using mod_jk

    Hi, I'm trying to get Apache version 2 Server running with Tomcat 7 as the Java Servlet container (I'll be using Solr as the webapp next). Followed the instructions in the wiki articles Tomcat and Apache and Tomcat. The applications work fine separat

  • Laptop and tv hook up

    i have a Gateway - FX Edition Laptop with Intel® Centrino® 2 Processor Technology what cable do i need to hook it to a tv?

  • Macbook pro battery bloated

    Hi, I bought my Mac Book Pro in Jun 2008 with three years apple care. Just couple of days ago the battery got bloated. I am very upset that it happen just few month after the Apple care ended. Apparently there is a Apple Battery Replacement Program t

  • Need help printing

    I'm writing a program that is supposed to track and organize data and then print a report of the data from my printer but I can't quite figure out how to make the printer print. If someone knows where I can find a tutorial on printing in Java, I'd re