SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Long article pagination based on height

    I am trying to do a pagination for long article which has html tags inside based on height.

    For ex: Within Max height 768, i want to display the article with pagination.
    My article may have html tags <b></b>,<i></i>,<img/>, etc.

    I've done this by fixing the number of characters per page. But the tags also coming under the character count.

    Total chars per page = 3000
    my 3000th char is <, 30001 - 3004 chars are br/>.

    So <br/> tag gets splitted.

    Please help on this.


    Thanks

  2. #2
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you fetching this out of a database?
    1: I would first get the length by applying $copy = strip_tags($yourContent); Now you can measure accurately 3000 characters, but what if a word gets split?

    2: Then you could do a regular expression to match maybe the last sentence from the copy. strstr(substr($copy, 0, -50), ....

    Err actually, this is a tricky one, but I tried to get the ball rolling :P

  3. #3
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JREAM View Post
    Are you fetching this out of a database?
    1: I would first get the length by applying $copy = strip_tags($yourContent); Now you can measure accurately 3000 characters, but what if a word gets split?

    2: Then you could do a regular expression to match maybe the last sentence from the copy. strstr(substr($copy, 0, -50), ....

    Err actually, this is a tricky one, but I tried to get the ball rolling :P

    Thanks for your reply.
    I want the line break for <br/> tag. I dont want to strip the tags.

    Please help me.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •