Paginate only 1 DB field |
[eluser]Anonymous[/eluser]
Hi, I'm having problems developing a fixed height website. The content from the website is delivered from a database (CMS). The content div has a fixed height, when the page content is too long, it has to be cut off and display a next page link. Is there a way to paginate this ? Or any other solution ? kind regards
[eluser]pashj[/eluser]
Off the top of my head, you could add "overflow:auto" to the div style. Then if the content "overflows" the size of the div, little scrollbars will appear, but the div will remain the size that you've set. It's not pretty (IMHO) but it's dead quick. #your_div_id{ height:300px; width:600px; overflow:auto; }
[eluser]Anonymous[/eluser]
That was my first thought too. But my client wants a next page button :/
[eluser]Aidy[/eluser]
Sorry you mean for a single record/row.. Maybe you could split your data into an array according to length in the controller and paginate or you could do on the client jquery have a good plugin http://plugins.jquery.com/project/pagination
[eluser]Anonymous[/eluser]
Yeah I want to truncate the text and add some kind of pagination :/
[eluser]danmontgomery[/eluser]
There's no way for PHP to determine the amount of screen space a block of text will take up. The only thing you can do is filter the text by the number of characters or words. If you want to specifically access the amount of space the text takes up you'll need to use javascript, I'd suggest a library like jquery.
[eluser]Anonymous[/eluser]
Filtering by number of characters or words is no problem. But i really don't know where to start. Google isn't helping me either. edit: jquery would be fine to, but none of the truncate scripts have a function to replace instead of the usual less/more
[eluser]danmontgomery[/eluser]
http://php.net/manual/en/function.substr.php |
Welcome Guest, Not a member yet? Register Sign In |