RampantGiraffe Posted March 15, 2006 Share Posted March 15, 2006 Hi guys. I have trawled countless forums and tutorials on various websites Devnetwork, phpbuilder etc and I can't really seem to find an answer to my problem. Maybe they just haven't been explained in a way I understand yet. :/ I have already paginated my results pulled from MySQL database... it was easy I copied the tutorial in the book (I'm sure there is a better way of writing it but I'll go back and look at that when I'm a bit more proficient). I am pulling records from MySQL database which are articles with some images included. The articles are of various lengths and the images various sizes. As the result of this limiting to 5 records per page has different results depending on which articles are to be displayed. Page 1 currently has a lot of space at the bottom of the page as the articles displayed here are quite short. Page 2 has large articles and overshoots the bottom of my page template causing the /div its posted in to continue on past the bottom of the rest of my page. Is there a way of limiting results based on total number of characters contained in a specific field (if I establish how many characters could fit on the page to begin with)instead of just limiting by number of rows returned? Or is it possible to create (from the query results) a page height variable that can be posted to the other parts of my web page so that the rest of the site fits the results. If either is possible which would be the better of the two? If not any suggestions with how to deal with this? Any links to resources which might give me ideas on where to start with the coding would also be appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/5029-pagination/ Share on other sites More sharing options...
AV1611 Posted March 15, 2006 Share Posted March 15, 2006 You could count the number of characters in a post and use some clauses, but I have another thought..When you insert the articles into the database, perhaps you could classify them as LONG, MED, SHORT, then use some logic like LONG=2*MED and MED=2*SHORT, so you post 1 LONG or 2 MED or 4 SHORT or 1 MED and 2 SHORT, etc...Now it's just building the logic in your querries... Quote Link to comment https://forums.phpfreaks.com/topic/5029-pagination/#findComment-17814 Share on other sites More sharing options...
lessthanthree Posted March 15, 2006 Share Posted March 15, 2006 You can trim the length of the text returned by using the php function substr(). I would howerver suggest that you fit the way your html works to allow any size text to be placed in your div without stretching out of the rest of the page. Your css should not allow a div insidea containing div to outsize the container. (i.e the container should enlarge first, allowing the inside div to also expand, allowing the full text to be placed into it.) Quote Link to comment https://forums.phpfreaks.com/topic/5029-pagination/#findComment-17815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.