SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multi page articles

    I'm looking to build an article script for several of my sites (and anyone else that want it)

    What I want to be able to do is pull some text from a database/text file, and diaplay it on a page.

    Simple I hear you say

    now for the hard part, I want to be able to split the page up at several parts within the text where I specify.

    eg.

    PHP Code:
    Welcome to my documentI hope you like it.
    %
    newpage%
    This is the second page of my document.
    %
    newpage%
    Wowthis must be a riviting read for youI hope you don't fall asleep
    %newpage%
    OK, i'
    ll stop :-) 
    Now whereever %newpage% (or whatever) I want the page to stop and display a next page link, which when clicked displays the next page

    I know this can be done, for example i've seen it in phpnuke in the sections module.

    Thanx all....


    PS, Once i've figued this out, i'll be interested in learning how to name each of the pages, but lets work one step at a time.
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.

  2. #2
    Former Staff Member silver trophy Adam P.'s Avatar
    Join Date
    Apr 2001
    Location
    San Francisco
    Posts
    3,288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had a question kind of like that in another thread. I got some really good answers, especially near the bottom. Check it out here:
    http://www.sitepointforums.com/showt...threadid=30995

    Hope this helps!
    SPF Mentor/Advisor 2001-2003
    SPF Designer of the Year 2002
    SPF Graphic Designer of the Year 2003
    AdamPolselli.com

  3. #3
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the link, i'll check it out.
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.

  4. #4
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the answer to another question that I had, however it does not solve the problem that I have.

    Thank you again anyway.
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.

  5. #5
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know that very similar topics have been discussed in the past. So I did an advanced search of the php/mysql forum for "next AND page AND previous" and came up with these search results:
    http://sitepointforums.com/search.ph...der=descending

    I am pretty sure you will find some useful info in one of those threads

  6. #6
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Do you think this would work

    I've just been trying to get to sleep (it's 5:00am here), but one of the sad things about me is that if I have a codeing problem it will continue to go though my head until I solve it, hence the reason i'm still awake.

    Do you think that this would work?

    PHP Code:
    <?
    $article 
    "<p>This is page one, do you like it?</p>
    <newpage>
    <p>This is page two</p>
    <newpage>
    <p>this is page three</p>"
    ;

    $show_article explode("<newpage>"$article);

    echo 
    $show_article[1//returns page one
    echo $show_article[2//returns page two
    //etc...
    ?>
    I know that the code is untidy, but in theory will this work?
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.

  7. #7
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freakysid
    I know that very similar topics have been discussed in the past. So I did an advanced search<snip>
    Oh, thank you for this link, I did check it out, but i still could not find quite what I was looking for
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.

  8. #8
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, that looks like a nice simple solution if you can't be bothered breaking up the article into seperate records in the database for each page.

    Of course page one will be $show_article[0], or if you wanted to you could put the summary info before the first <newpage> delimiter so that $show_page[0] might itself hold other values such as <title>Foo</title><author>Joe Blow</author>...

    and - what do you know - you've created your own little XML scheme and a simple little parser for it!

    Also, you would want to hold the value of the current page in a variable so that you can generate previous/next links.

    Eg;
    PHP Code:
    $pageNo 2;
    $totalPages 4;
    echo 
    $show_article[$pageNo]; 
    and of course build in appropriate logic to generate the next/prev links


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
  •