2 Replies Latest reply on Jan 1, 2007 7:05 PM by kishorebudha

    show part of record

    kishorebudha
      I have created a blog site. the home page lists all the latest blog entries. each blog entry can be clicked to open (display full text) in a separate page. However, currently my code shows the entire entry on the home page itself. I would like only the first 15 lines of the full text to be displayed. The code of the home page is as follows:

        • 1. Re: show part of record
          Dan Bracuk Level 5
          Figure out how many words are in 15 lines. Then treat the blog as a space delimited list and set up a loop to output the appropriate number of words.
          • 2. Re: show part of record
            kishorebudha Level 1
            A simpler way is to use left function and specify the number of characters at which the field is to be truncated:

            #left(blog_contents, 700)#

            This posed a fresh problem as the blog entry field included HTML code. So if the end tag had been chopped off, the rest of the enries ended up being formatted with the start tag creating quite an ugly looking page. So I solved this by stripping the field of all HTML tags by using a nested function:

            #left(rereplace(blog_contents,"<[^>]*>", "", "All"), 700)#