Gossamer Forum
Home : Products : Links 2.0 : Customization :

display so many words at a time.

Quote Reply
display so many words at a time.
Hi.. is it possible.. that if you have a description of 100 words.. to display only the first 10 words..

as an example.. a brief description then a click through to a more detailed description..

Has any1 got any ideas on how this can be done..

thanxs in advance.. Justin
Quote Reply
Re: [JustinS] display so many words at a time. In reply to
I'm not sure where you are doing this but you could do something like the example here

Code:
sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.
my %rec = @_;
my $clean_title = substr($rec{'Title'},0, 99);
return &load_template (link.html', {
title_linked => $title_linked,
clean_title => $clean_title,
title_unlinked => $title_unlinked,
%rec,
%globals
} );
}


you could even tack on the "..."


then use <%clean_title%> in the html page

I didn't try it out...


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] display so many words at a time. In reply to
thanxs for the reply.. i get an error on the build..

error on line 113.. Bad name after html'

this bit... return &load_template (link.html', {

Please note that i do not use the template method..

Any ideas.. thanxs.. Justin..
Quote Reply
Re: [JustinS] display so many words at a time. In reply to
Nope. The above is for the template method.

You could try something like the following:

Code:

my (%rec) = @_;
my $clean_title = substr($rec{'Title'},0, 99);
$build_detailed ?
($output = qq~<ul><li><a class="link" href="$build_detail_url/$rec{$db_key}$build_extension">$clean_title</a>~) :


But I always used the templates and don't know much about the non-template method.

And I don't know much Perl and I am trying very hard to forget what little I do know! Wink


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] display so many words at a time. In reply to
that worked fantastic.. thanxs v.much...