How to determine the last row of the print area in PHPExcel? - php

I have a large table, which does not always fit on a print page. If the table does not fit on one print page, script must write "Contunue on next page" into last row of current page. How to do it?

My guess is that you are building a page updated by javascript.
I can provide 2 answers here:
from a usability point of view, you should add "next page" both
before and after the table. By then, a user that is searching for a
specific page don't have to scroll down all the page to go to next
page
from a technical point of view, there's no reason to put the next
page inside the table. Just put it into a and just name it if
you need to access to it later on.
In case my guess wasn't correct, can you please give more detail about your problem (includig relevant code snippets)?

Related

What is the best way to implement "Prev" & "Next" function in a single result page but keep the order of previous search result?

There is a similar question here Best way to implement <next>, <prev> element links from search list
But I'm not satisfied with that answer, and my case is slightly different, and I want to know the best way more commonly.
I have a search page, let's say, searching poems. (currently the data is from mysql, but I'm planning to index them into apache solr)
Each result on the search result page (let's say, /search?keyword=flower&author=john) is a link, which you can click and will be redirected to the poem detail page.
(let's say, /poem/1234/This-is-the-best-poem)
Now I want "prev" and "next" links on the detail page if the page is clicked from a search result page. and it uses the same order of the search results.
What I can think is to add full search parameters to the detail page, so the "detail page with pagination" actually is a search results but perpage = 1.
But I have to do the full query everytime showing a poem detail page.
I wonder is there a better way ?
Thanks and apologize for my bad English.
As for the Solr part of this, you can use DeepPaging, take a look here:
http://heliosearch.org/solr/paging-and-deep-paging/
You get a 'cursorMark' from Solr when you use DeepPaging which works
like sort of a book mark for your next query results.
You will have to requery, but you will stay in the same result set using that flag,
so when you do this only for the next document you will have to get only one row,
remember your current position where to start,
save the cursor mark and repeat all of that for the next.
By remembering previous cursorMarks you can also go back.
Regards,
Markus
You have to get the poem from the db for the detail. But the rest of the parameters can be passed on from the list page, including a list (array) of poem IDs retrieved in the paged list. You could use this until you reach the end of list, to retrieve the next page list.
You might also want to consider caching options available on the server. APC extension is common on PHP.

pagination with Zend Paginator showing previous, first, last, next, current & current +/- 1

i'm trying to put together pagination for my page using Zend Paginator.
i followed this exmaple (by Lee Davis): http://www.duckheads.co.uk/zend-paginator-example/265
what i expect is more less described in requirements on that page:
Must be able to jump to the first results page at any time by clicking the first page number (1)
Must be able to jump to the last results page at any time by clicking the last page number
Must be able to jump forward one page
Must be able to jump back one page
Must show the current page the user is on
Must show surrounding pages from the page the user is currently on
I implemented the pagination as per the article mentioned however it does not work exactly as i expected from the screenshot. e.g. it shows more than 1 surrounding page on each side of current page.
Screenshot from the article: http://i.stack.imgur.com/ihrIt.jpg
I'm calling the paginationControl method with 'Sliding' parameter.
I wonder if you might know of any modification to example code (from the article) that could make it work the as expected i.e. with changed the last requirement to
Must show 1 surrounding page on each side of the page the user is currently on
thank you in advance for nudging me the right way
Looking at the doc, I think that tremely set your Zend_Paginator if you add:
$paginator = new Zend_Paginator(...);
$paginator->setPageRange(3);
it should work.
Keep me informed. :)

Moving through Detail Pages of Recordset

My website allows visitors to search for homes (using PHP and MySql). After the search, they are presented with a list of matches which they can click on to see the detail page for that home. To see the next home, they currently have to click back, then click on the next home in the search results list they want to view.
I would like to make it so that once they have clicked on one home to view the details, they would have a "Next Home" and "Previous Home" link/button to use to navigate the results set without having to go back to the search results page.
I've seen this done, but can't get my head around how to do it. I assume you have to save the recordset from the initial search somewhere, and then recall it on the details page. And you'd have to know that you were looking at the xth home out of Y homes.
Can anyone give me a broad overview of how this would work? Do I save the initial search results in a temp MySQL table and pass that table name to the details page? Or use a session variable to hold the results set? Keep in mind that a visitor could make several different searches during their session.
Any assistance would be most appreciated,
Tom
When I've done this, I've saved the details of the current search in SESSION, and then requeried the database when I've needed to - so you can query it on the detail page to generate a Next and Previous link, and so on. I normally use a SESSION variable called 'parameters', and add the whole of the SQL WHERE statement to it.
If someone's making multiple searches, this will let them make one at a time - subsequent searches will over-write what's already in there. If your users are going to be making multiple searches at the same time using different parameters, you'll need to find a way to differentiate the parameters for each search. You can give each set a unique name by prefixing it with a call to uniqid, and you'll then need to make sure you pass the unique identifier to the detail page, so it can work out which set of parameters it needs to run.

Go to a specific part of a page from another page - Anchor Position and jQuery?

I have completely no idea where to start so I apologise about the lack of code presented to you.
My problem is - I have a page of information, ordered by ID (gathered from the database). These ID's are referenced from another page to which the user clicks on a link and it takes them to the page with the information on, how ever, there could be potentially hundreds of ID's on that page - So I need to reference each specific ID so when the user clicks, it will take them to the exact position of the ID.
I understand its something like localhost:8888/index.html#id3 etc..
But i'm struggling to understand how to reference for a PHP Variable.
Many thanks in advance.
You would use anchors, so for example, on the page where you list your information, attach an anchor to it such as #id1, then on your links page, you would place the #id1 at the end of the url results.html?#id3

What are some methods for handling pagination of long lists?

I'm wondering if there are any standard methods of keeping the correct pagination of real-time lists. For instance, on Stack Overflow if I go to page 2, and in the period of looking at page 1 a new question was submitted, how can I keep page 2 the same as it was when I started looking at page 1?
A lot of the time people will just do an SQL query using a LIMIT but this won't allow you to keep track of where page 1 ended and page 2 begins.
I imagine it can be done by keeping track of the ID of the last seen record or something.
I think most users are used to this behaviour and expect it to happen. When they go to the next page and they see the item that was at the end of the page they were just on is the first item of the current page, they will probably realize that it's because a new item was added. I know that I have depended on this behaviour as a user before to know when new content was added while browsing through the pages.
So my opinion is that you shouldn't have to do this.
We do this (your requested) behavior for all our paginated web UI's. (I have actually asked for that in SO, and had it declined - but I find the current repagination annoying and unexpected - I hate hitting "next" and having the first n items be the last ones from the previous page).
The trick is to retain (usually in hidden variables) sufficient key information to position the list immediately before item 1 and immediately after the last item for the page you are looking at. Then your previous and next page links supply that information to on submit. Effectively you retain a "previous page" and "next page" key. This works intuitively for insertions and deletions.
One thing to bear in mind is that a refresh on page 1 (assuming like SO a newest items first list) should either (a) activate the "previous" link, if it was hidden, or (b) refresh the list from the top, including the added items. In other words "refresh" always redisplays the page from the first item inclusively, but if the first item on the page was also the first item in the list and now there are new items, it redisplays from the beginning of the list. With our lists we usually have, standard, links for "first page", "previous page", "refresh", "next page" and "last page".
The alternative for seeing new items is to always have a previous link and it backs up the smaller of a full page or the top of the list - and that's how a user sees new items (but I prefer to hide/disable the previous/next when there's no items previous and/or next).

Categories