Gossamer Forum
Home : Products : Gossamer Links : Discussions :

upper and lower case

Quote Reply
upper and lower case
Hi,

is there a method to alter the case on categories. I am using SSI in some bits of my program so to use existing category names as part of the expression I have had to designate/name categories in lowercase - the reason being that I FTP with forced lowercase to make life in general easier.

If possible I would like all my displayed categories to have a uppercase first letter even though they are lowercase.

As an example I have say a text file called kev.txt on my server, uploaded and forced to lowecase, there are loads of files such as john.txt, mary.txt, jim.txt.

Within Links SQL I include (SSI in) a file based on the category selected such as include file <%Name%>.txt

That works great as the right file is called up BUT my categories are displayed all lowercase whereas it would be proper if it displayed John, Mary, Kev etc etc and not john, mary, kev.

Any ideas or is it a massive undertaking for a small bonus

Rgds

Kev

Cheers
KevM
Quote Reply
Re: [KevM] upper and lower case In reply to
Try the following;

Code:
sub {

my $action = $_[0];

if ($action eq "lower") { return lc($_[1]); }
elsif ($action eq "upper") { return uc($_[1]); }
elsif ($action eq "ucfirst") { return ucfirst($_[1]); }
else { return "Invalid action passed..."; }

}

Then call it with something like;

<%global_name('lower',$Description)%>
<%global_name('upper',$Description)%>
<%global_name('ucfirst',$Description)%>

..etc

Hope that helps :)

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: Jan 9, 2004, 6:44 AM
Quote Reply
Re: [Andy] upper and lower case In reply to
Thanks for the reply Andy,

I am quite new to Links and I don't actually know what to do with the code you have given me. I guess it is a subroutine of some sort.

Sorry, could you give me a pointer.

Also Links SQL already calls the categories ok (standard installation but it displays category names in the right places albeit all in lowercase) so will

<%global_name('lower',$Description)%>
<%global_name('upper',$Description)%>
<%global_name('ucfirst',$Description)%>


make all the categories displayed on screen by the program be in upper case. I guess the last bit is a global but I also don't know where to put it.

bear with me, I will get there,

rgds, Kev

Cheers
KevM
Quote Reply
Re: [KevM] upper and lower case In reply to
No problem. Its pretty simple. Goto Build > User Globals

...then at the bottom of that page, there will be a blank text area with a textfield too. In the smaller field, type;

upper_or_lower

...then in the content box, copy and paste the global I gave you.

Then submit the form.

In your templates, you can then use something like;

<%upper_or_lower($Title)%>

...intead of something like;

<%Title%>

Hope that helps :)

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!
Quote Reply
Re: [Andy] upper and lower case In reply to
Thanks Andy,

what I have done is call it 'case' in template globals (I do not have a user global link in my program - perhaps this is my problem)

I then called in search bar

old - search in <%Name%>

new - search in <%case($Name)%>

but it returns to me

search in Invalid action passed...



so I went back in and changed the name of it to upper_or_lower

and added <%upper_or_lower($Name)%>

but I still get invalid action passed.

Is this due to template globals and not user globals being changed?

Thanks for your patience

Kev

Cheers
KevM
Quote Reply
Re: [KevM] upper and lower case In reply to
Sorry, you need to pass the action through...i.e;

<%upper_or_lower('lower',$Description)%>
<%upper_or_lower('upper',$Description)%>
<%upper_or_lower('ucfirst',$Description)%>

At least you now know how to add globals :)

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!
Quote Reply
Re: [Andy] upper and lower case In reply to
I'm probabaly being really dumb but I still can make this work.

I tried

search in <%upper_or_lower('ucfirst',$Name)%>

but it now just says

search in

and thats it, the rest is now blank.

I also tried <%upper_or_lower('upper',$Name)%>

but the same, no return on the <%Name%> tag anymore.

rgds

Cheers
KevM