SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multiple page articles

    How do you go about creating this, from the form submission process to the database setup? I know about pagination, multiple articles across different pages, but what about one article across different pages. I know this is still in a sense pagination. I see sites that have reviews or articles that are to long to have on one page, so the have a next page link. How do you go about this? Is the whole article submitted in one process or broken into multiple uploads?

  2. #2
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Usually long pages are split over multiple pages, this can be achieved automatically, or manually, really doesnt matter.

    If automatically you can just split the submitted text after so many words to the nearest paragraph and save in the database as two pages.

    Does this answer you question ??
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So how do you go about splitting, auto would be best and then how do you link them in the database?

  4. #4
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That would depend on your database setup, but if your expecting articles to be split you'd make your database structure accept a page_number field, then when retreiving an article youd search the database for article_number and page_number.
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That makes sense, so how would i go about breaking the post into multiple pages? Should I type a special command like <break> in my post where I want it to, so it flows better page to page? Then break it into an array or something?

  6. #6
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes if you waqnt to have total control over where the file is split you could insert a break tag in the text then split the uploaded text with the explode() function.

    PHP Code:
    $uploaded  "This would be your uploaded text that is way too long for displaying <break>on one page because the poster went on and on and on and on and on and on";
    $pages explode("<break>"$uploaded);
    echo 
    $pages[0]; 
    echo 
    $pages[1]; 
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  7. #7
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry to post in an old thread, I was coding as mentioned above. But recently someone told me that this was a bad idea. What I should do is post the whole article in the Database then use php to break it up and paginate. The only problem I see with this is if they say go to the url of page two, I have to pull the whole article out then figure out where page two would start. What do you think is the better approach of the two?

  8. #8
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I took documents such as a constitution and department sop's which were multiple page documents. I stored the contents off in a txt file in a docs directory. The formatting and html for correct display are included, when I need to display a page I use a base page class for headers, footers, menus... the mundane stuff that does not change. In my display function I simply use readfile(), this not only reads the page txt but echos it back to the output buffer. The text files are all named alike with an underscore and numeric tag so I know which to call.
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.

  9. #9
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the suggestion, but this is being done with a database, not .txt files. I've got the concept of loading data in with static header/footer's, but this is more of a database design issue; which to choose.

  10. #10
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    storing the whole article in the database and then using php to split it up is a good approach, because you don't have to change the database if you later decide you want to split the article over fourteen pages instead of seventeen (imagine the headache of deleting seventeen database entries and then re-inserting fourteen)

    to answer your question: yes, you would "have to pull the whole article out then figure out where page two would start"

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  11. #11
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never thought of that thank you. Then I guess my main question is now, how would you recommend of a way of splitting the article up? Especially if I know where I "want" it split.

  12. #12
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by 700lbGorilla View Post
    Never thought of that thank you. Then I guess my main question is now, how would you recommend of a way of splitting the article up? Especially if I know where I "want" it split.
    can you explain in words where this place is?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  13. #13
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well every article will be different, one might be a top 10 specific movies and show two movies with their paragraphs per page. Some articles are just plain articles but might be to long for one page, so I'd want to split it in certain parts that keep the flow and are good parts to start a new page. By "want" I meant when posting, if I have a good idea of where I want it split for each article, what would be a good way to do this. Above I mentioned inserting a <break> command that would divide where a new page starts, but that was for making an array and posting each as a new database entry.

  14. #14
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    use the same idea, but use valid html instead of <break>

    perhaps <!-- break -->
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  15. #15
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I'll give it a try, thank you for your help and view on the issue!


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
  •