3 Replies Latest reply on Jan 22, 2009 9:12 AM by Günter Schenk

    Way to Shorten an Article and Add Read More Link?

    Level 1
      Hi,

      I am using the content management tutorial and on the homepage of my site, there will be articles displayed. Is there a way to only allow maybe the first few paragraphs to show up and then add a read more link to view the complete article on another page using ADDT?

      I am getting around this currently by having a description field that will be the shortened text that shows up on the homepage, then a body field that will contain the complete article.

      This works, however, I will eventually turn this CMS over to someone else who is not literate in web design (a secretary) and I would like to dummy proof it as much as possible. I would like it if she could just cut and paste in the article and it would automatically shorten it without her having to do too much.

      Is there a way?

      Thanks
      John
        • 1. Re: Way to Shorten an Article and Add Read More Link?
          Günter Schenk Level 4
          Hi John,

          one possibility would be to use a custom "truncate text" PHP function as described in this thread on the Interakt forums:

          http://www.interaktonline.com/Support/Forums/PHP-General-Forum/Details/21143/Break+text!.h tml

          -------
          I am getting around this currently by having a description field that will be the shortened text that shows up on the homepage, then a body field that will contain the complete article
          -------

          IMO this might still be the better approach, and I think it all depends on how the secretary uses to write her articles -- what if the main article´s first paragraph just doesn´t contain stuff which would qualify as "summary" ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Way to Shorten an Article and Add Read More Link?
            Level 1
            Thanks again Gunter!

            The solution on the linked page you gave me worked great. Now, I wont scrap my initial page with the "description" being the first page content...I can just see them saying "it cuts off the article without finishing a sentence..." or something like that. But, in the meantime, this is going to work out great!

            Regards,
            John
            • 3. Re: Way to Shorten an Article and Add Read More Link?
              Günter Schenk Level 4
              Hi John,

              another method would be to retrieve the contents of the first paragraph using a custom regular expression pattern -- but then again this paragraph would always have to be enclosed in "p" start and end tags for making this work.

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver