[ic] limit text output on table query

Bill Carr interchange-users@icdevgroup.org
Wed Sep 4 06:23:03 2002


On Wed, 2002-09-04 at 00:37, Philip S. Hempel wrote:
> I looked through the mail list and docs and
> I seem to not find anything on how to
> limit text from a query on a table
> 
> I would like to have is the ability to display
> a few lines (characters) from our comment table
> something like a teaser of sorts without having to
> modify anything for the item.
> 
> What I have done is created a few pages that
> pull out particular products and spit them out
> onto a page, I want to place a small portion of it
> into the area below the product ID.
> 
> My problem is that the content for our comments is
> enormous and over takes the blocks, I have tried setting
> the table height and that becomes a problem since some
> other info then gets lost.
> And also  is there some widget I can use to place into
> each product description that would put a page break
> 
> i.e.
> 
> IMAGE
> 
> " ... this product has already 40 lines of data
> some more info and alot more"
> 
> [more info] <--- this produces a page break to follow next
> 
> IMAGE
> 
> "more data about this product lots more data
> another 400 lines of data"
> 
> This is an idea I have seen with ezpublish at
> developer.ez.no that peforms the same operation
> 
> 
> the link to this is at
> 
> http://www.blossomland.com/bl/beeswaxcandles/beeswax.html
> 
> I am not sure if it would help but I can make the
> source available as well.
> 
> If anyone has some ideas please let me know.
> 
> btw I am using table organize to do this with a loop on the products.
> 
> -- 
> 	-------------------------
> 	    Philip S. Hempel
I am really going out on the limb exposing my PERL code to the group.

UserTag truncate Order num morelink
UserTag truncate Interpolate 1
UserTag truncate HasEndTag 1
UserTag truncate Routine <<EOR
  sub {
        my ($num, $morelink, $text) = @_;
        $num = 20 unless $num;
        $num--;
        my $out = $text =~ /^\s*(\"?)((\S+\s+){$num}\S+)/s ?
qq{$1$2...$1} : $text;
        $out .= qq{&nbsp;<a href=$morelink>more</a>} if ($2 &&
$morelink); 
        return $out;
  }
EOR

-- 
Bill Carr
Worldwide Impact
bill@worldwideimpact.com
413-253-6700