Print pagination help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Print pagination help (/showthread.php?tid=30197) |
Print pagination help - El Forum - 05-06-2010 [eluser]georgeedwards[/eluser] Hello everyone! Hope you're all well.. Could anyone help me with a little bit of a traditional PHP/logic problem? (my brain is really not working today). Situation is, I have a client project in CI that prints out load sheets for lorries (they are a delivery firm). I.e. there will be several "delivery runs" a day, then each run will have several deliveries for that day. Traditional nested foreach type thing. There is a view that does this and it is very basic. But I want to try and smarten it up with a pagination/page count e.g. Page 1 of 3 etc. Put simply, it's like this (code is stripped down completely for simplicity): Code: <?php foreach ($runs as $run): ?> As you can see I've managed to set it so that only 5 deliveries get shown per page, and it breaks after that. On that basis, I've also used ceil() to work out how many pages there will be if there is 5 deliveries on each. But I can't for the life of me workout how to set either a header or a footer saying "Page 1 of 3 / Page 2 of 3" and so on through the pages. Anyone have any ideas to point me in the right direction? Thanks for your time Print pagination help - El Forum - 05-06-2010 [eluser]dmorin[/eluser] I really don't know if you can set header/footer text when printing from a browser. It would seem like generating PDFs instead of just html would give you much more flexibility to do what you're looking to do. are PDFs a viable option? One other option would be to see if you can just configure the browser to print the page X or Y since it's the one generally responsible for header/footer text. Print pagination help - El Forum - 05-06-2010 [eluser]georgeedwards[/eluser] [quote author="dmorin" date="1273178126"]I really don't know if you can set header/footer text when printing from a browser. It would seem like generating PDFs instead of just html would give you much more flexibility to do what you're looking to do. are PDFs a viable option? One other option would be to see if you can just configure the browser to print the page X or Y since it's the one generally responsible for header/footer text.[/quote] Hey! Thanks for your reply. PDFs are an option, but as I have the system pretty much finished now, and everything is working ok, I don't really want to back track and rewrite all the views etc for a library like FPDF... especially when just looking at the docs for the common PDF libs scare me... it's like learning a whole new language. It looks so complicated to do something so simple! And regarding browser page numbers, yes it would be a viable option, except that I am printing a batch of sheets from one view, so I would need to "restart numbering" as such for each group. Otherwise I would get a total Page X of Y for the entire set, whereas I want to have individual numbering for each set. Thanks for your help though |