Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [Payooo] Short description ... read more

Quote Reply
Re: [Payooo] Short description ... read more In reply to
Give this one a go :)

Code:
sub {

my $id = $_[0];
my $desc = $_[1];
my $chars = $_[2] || '300';
my $build_url = $CFG->{build_root_url};

if (!$desc) { return "No description on this template"; }

length $desc < $chars and return $desc;
my $short = substr ($desc, 0, $chars);
$short =~ s/\s\S+?$//;
$short .= "<b> ... read more</b>";
return $short;

my $detailed_url = "$build_url/Detailed/$id.html";
$short .= qq|<b> ... <a href="$detailed_url">read more</a></b>|;

}

...you can call it with;

<%global($ID,$Description,'300')%>

Basically, you need to pass in ID, Description and how many charachters you want to use :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Oct 8, 2004, 7:17 AM
Subject Author Views Date
Thread Short description ... read more rsahertian 3623 Feb 24, 2004, 11:09 AM
Thread Re: [rsahertian] Short description ... read more
Andy 3586 Feb 24, 2004, 11:18 AM
Thread Re: [Andy] Short description ... read more
rsahertian 3579 Feb 24, 2004, 11:45 AM
Thread Re: [rsahertian] Short description ... read more
afinlr 3553 Feb 24, 2004, 2:08 PM
Thread Re: [afinlr] Short description ... read more
Andy 3565 Feb 24, 2004, 2:19 PM
Thread Re: [Andy] Short description ... read more
Payooo 3548 Feb 24, 2004, 6:12 PM
Thread Re: [Payooo] Short description ... read more
Andy 3530 Feb 25, 2004, 1:29 AM
Thread Re: [Andy] Short description ... read more
Payooo 3532 Feb 25, 2004, 3:05 AM
Thread Re: [Payooo] Short description ... read more
Andy 3516 Feb 25, 2004, 3:09 AM
Post Re: [Andy] Short description ... read more
Payooo 3499 Feb 25, 2004, 3:13 AM