开发者

How To Paginate A Long Text Post

I'm Creating a website for online reading stories using grails and i'm facing a business problem that if i post a story say 30 pages A4 in the Fckeditor and it had saved will .. the question is how can i display this in a 30 pages with a pagination or something like that.. do anyone have idea cause i'm out of simple ideas and i think making many lists of the sto开发者_如何学Pythonry is a rough idea.. so is there any java/grails/groovy or even jQuery idea that can save my day?


You're probably going to have to write some custom code here.

If you want to auto-paginate, then you'll have to index into the string and grab a fixed number of characters, words, paragraphs, or whatever makes sense. If you don't need to auto-paginate, then you can embed pagination information in the text string. Either way you'll have to expose a page number field in the view, then use that to page into the text based on what the user provided.

Sorry I don't have a more elegant solution.


If you are willing to do it client-side then there are jQuery options, such as SimplePager plugin or jQuery Paginate. You will probably need your HTML to be divided into "segments" such as DIVs or LIs or something divisible, though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜