Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Detailed Rewrite Lowercase?

Quote Reply
Detailed Rewrite Lowercase?
I'm using Yogi's code for Detailed Rewrite:

Code:

sub { my $ID = shift; my $Title = shift; my $cats = $DB->table('Links')->get_categories($ID); my ($cat_id,$cat_full_name) = each %$cats; my $cat_url = $DB->table('Category')->as_url($cat_full_name); $Title =~ y/ \t\r\n?"'#/__/d; return '/' . $cat_url . '/' . $Title . '_L' . $ID . '/'; }

What change would be needed to have the Detailed $Title in lowercase instead of the current mixed case?
Quote Reply
Re: [Karen] Detailed Rewrite Lowercase? In reply to
Try changing;

Code:
. $Title .

to

Code:
. lc($Title) .

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] Detailed Rewrite Lowercase? In reply to
That worked well. Thank you, Andy.

Found another alpha case problem though. Using that same global, Yogi had provided a second global in the forums for the Prev/Net links, get_detailed_url.

Code:
sub {
my $link_id = shift;
my $link_db = $DB->table('Links');
my $link = $link_db->select({ ID => $link_id })->fetchrow_hashref;
my ($cat_id, $cat_name) = each %{$link_db->get_categories ($link->{ID})};
$cat_name =~ tr/\t\r\n?"'#/__/d;
$link->{Title} =~ tr/\t\r\n?"'#/__/d;
return "$CFG->{build_root_url}/$cat_name/$link->{Title}" . "_L$link->{ID}/";
}


This one is writing the Categories and Title using mixed case. Can you advise how to make changes on this one for changing to lower case lettering? I tried changing $cat_name and $link to lc($cat_name) and lc($link) but that didn't work. If it helps any, I am using a BuildDirectory field in the categories that is already lowercase and doesn't use odd characters that may appear in the actual Category Name. Actually, it would be especially helpful to me if the global did use the BuildDirectory field instead of Full_Name as I have some categories building outside their parent directory.

Thanks again, Andy.
Quote Reply
Re: [Karen] Detailed Rewrite Lowercase? In reply to
Edit;

Code:
return "$CFG->{build_root_url}/$cat_name/$link->{Title}" . "_L$link->{ID}/";

...to

Code:
return "$CFG->{build_root_url}/" . lc($cat_name ."/". $link->{Title}) . "_L$link->{ID}/";

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: Feb 21, 2004, 6:18 AM
Quote Reply
Re: [Andy] Detailed Rewrite Lowercase? In reply to
Woohoo! Getting closer. That worked for the link Title. It's still grabbing the entire category path and using mixed case there though.

Category Name = /BuildRoot/TopCategory/SubCategory/SubSubCategory
Category Build = /buildroot/subcategory/subsubcategory

The Prev/Next links are now displaying the Category Name path:
/BuildRoot/TopCategory/SubCategory/SubSubCategory/link_title_L###/

Can they be changed to display using the Category Build path and case:
/buildroot/subcategory/subsubcategory/link_title_L###/

Thanks again, Andy.
Quote Reply
Re: [Karen] Detailed Rewrite Lowercase? In reply to
Give the modified version a go :)

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] Detailed Rewrite Lowercase? In reply to
Thanks, Andy. Everything is now lowercase. Only remaining problem is the path, the path is still using the full name path instead of the build name path - which is different from full name in some instances. Do you have suggestions on how I can use the build path instead of name path?

~ Karen