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

Global: Capitalize (capitalise) first letter of description

Quote Reply
Global: Capitalize (capitalise) first letter of description
Hi,

Just thought I'd post this here in case it's useful to anyone else in the future.

I've just upgraded my Links installation and because my previous install had the link description follow on directly after the link title, all the descriptions had lowercase letters at the start.

My new format has the description underneath the link, and therefore needs the descriptions re-capitalising.

Rather than sit and edit thousands of links I came up with the following global to display the description with a capitalised first letter.

Global name: UpperDesc

Code:

sub {
my $vars = shift;
my $descr = $vars->{Description};
my $updescr = ucfirst($descr);
return $updescr;
}


Then in the link template, replace <%Description%> with <%UpperDesc%>

Smile
Quote Reply
Re: [qango] Global: Capitalize (capitalise) first letter of description In reply to
Thanks!!! Should come in handy.

BWT- Your site looks good... came across it few weeks ago when doing directory submissions. Might have to submit a few
Quote Reply
Re: [qango] Global: Capitalize (capitalise) first letter of description In reply to
Sorry, couldn't help myself :) (just a little shorter, not sure it would make a major speed difference);

Code:
sub { return ucfirst($_[0]); }

.. call with: <%global_name($Description)%>

Smile

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!