We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33453
    • 141 Posts
    Can anyone suggest an easy way to split a long article into a number of pages without actually creating separate pages?

    What I have in mind is something like the [<!-- splitter -->] in the Newslisting snippet which behaves like the pagination in Newslisting but for the actual text of the article rather than the summaries to create a number of pseudo pages.

    I expect that this would mean messing with the core, which I am not too keen on, however if you can’t suggest an easy method, I will accept a difficult one grin

    Thank you
      • 32241
      • 1,495 Posts
      I believe there are easier way to do it, which is using dhtml, and have it in several layers, and make seemlesly appeared as if it’s on different pages. The bad thing is, you need to include a code in your database. Another solution which is to use plugin and tap into the document and apply a div that act as a layer.

      Well anyway, I have no experience in this kind of stuff, so hoopefully my idea can be an inspiring solution for you.


      Sincerely,
      Wendy Novianto
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 33393
        • 30 Posts
        I was thinking about the same thing for a site I’d like to develop. The easiest way I can think of is to create a snippet that would check the size of the article (content field in the database) then divide it into equal sized chunks to display over however many pages.

        I haven’t tried to create a snippet yet but it’s the best way to learn php, and I may eventually.

        I think you can check the length of the content field within a mysql query and then divide the text into arbitrary chunks (number of characters?) to get the number of pages you’ll need and retrieve just the first page section, and create the 1,2,3,4... page links you need to retrieve each part with subsequent requests. I haven’t worked it out yet. Not sure I will be able to either - but I won’t know until I try!

        Actually there are probably a number of pagination scripts out there that could be ’borrowed’ and modified.
          "Adversus solem ne loquitor." -don’t speak against the sun (don’t waste your time arguing the obvious) Something I sometimes need to be reminded of.
          • 18397
          • 3,250 Posts
          You could create a snippet that would follow the following logic:

          Get content field of current document

          Trim content based on # of characters to be show (passed through the smart filter in NL to catch open tags) starting at the nth character (retrieved from URL)

          Output results
            • 33453
            • 141 Posts
            Thanks for the replies.

            Wendy - I have thought about using divs but, in this case, I want it to appear as if the page has changed. However, I have an idea about that.

            Zatoichi, Mark - the problem with using a fixed number of characters is that the sense of the article may be disrupted. It is better to let the author choose where the breaks occur, I think.

            Since noone has said "there is already a snippet to do this" then I shall have a go myself, probably combining both ideas. If it works out and is any good I shall, of course, post it back to the forum.


              • 32241
              • 1,495 Posts
              Nice zenmaster.

              I believe you can use plugin to handle the querystring to determine which sub pages that they are browsing, and I believe you can tap into the document parse, right before they parse the content, and you can use regular expression or some other string function to determine the splitter point, and substitue the TV with the right contanent.

              Let us know if you could do it.

              SIncerely,
              Wendy NOvianto
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 33337
                • 3,975 Posts
                Quote from: zenmaster at Dec 18, 2005, 01:22 PM

                Zatoichi, Mark - the problem with using a fixed number of characters is that the sense of the article may be disrupted. It is better to let the author choose where the breaks occur, I think.

                I am for it ! let the author choose where to break, also if the other solution (dynamic pagination) can also be done parallel then it would be GREAT smiley

                Also, in latest NewsListing snippet, Mark has done a pagination thing, I hope taking a brief look at it will aid you in snippet development. wink

                Good luck and regards,

                zi
                  Zaigham R - MODX Professional | Skype | Email | Twitter

                  Digging the interwebs for #MODX gems and bringing it to you. modx.link
                  • 17883
                  • 1,039 Posts
                  hi, something new here? Just looking for the same... wink

                  greetz Marc