SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating a [page] BBcode for multiple pages...

    Is there any way for me to setup a [page] BBcode for my CMS... so that when a user types that into his articles/text/walkthrough/etc. it will automatically cut the text to multiple pages (wherever there is [page] tag)?

    Any help at all or something to lead me in the right direction would help lots!

    MGM out

  2. #2
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, the simplest possible approach would be:

    if someone requests say, article.php?id=123&page=5
    take the text of article #123 from DB
    split it into pages: $array = explode("[page]", $text);
    output ($page-1)th element from $array.
    build page navigation depending on number of elements in $array

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wouldn't that just break the text into 5 even pieces though? That could split the text where we don't want it split...

    MGM out

  4. #4
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Maine
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's when you get into pagination.


  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any other tips at all?

    MGM out

  6. #6
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Maine
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you should mix the method that stereofrog talked about with pagination. I suggest you read up on pagination at phpfreaks.com.


  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I already know pagination... but the method he describes, from what I got out of it, was that it breaks up the entire text into however many [page] tags there are, but not at WHERE they are but into equal parts

    MGM out


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
  •