Gossamer Forum
Home : Products : Gossamer Links : Discussions :

title_linked modification

Quote Reply
title_linked modification
Hi,

I'm trying to modify title_linked so the displayed text is the categories' Meta Description field instead of Name. (the url would still be derived from Name)

For example, the category named 'netherlandsantilles' should be displayed as 'Netherlands Antilles' (that is in the Meta Description field) and be linked http://www.exploitz.com/...antilles/index.shtml

I looked in Build.pm where it seems like all the action is and I see $dirs[$_] in sub build_title_linked. I've tried substituting various things throughout Build.pm but nothing has worked so far. For example:

$output .= qq| <a href="$CFG->{build_root_url}$path/$CFG->{build_index}">$display{meta_name}</a>

Any ideas on how to make this modification?

thanks
Quote Reply
Re: [estjohn] title_linked modification In reply to
Not quite sure what you mean...but try this as a global;

Code:
sub {

my $title_linked = shift;
my $meta_name = shift;
my ($sliced1,$sliced2);

($sliced1,$sliced2) =~ m#<a href="(^.?)">(^.?)</a>#i;

my $new_linked = "<a href="$sliced1">$meta_name</a>";

return $new_linked;

}

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] title_linked modification In reply to
This won't work.

You need to look up the meta name for every category. It's not so difficult to implement, but I don't have time to do it.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Andy] title_linked modification In reply to
Thanks Andy, couldn't get it to work still.

I'm trying change the following:

1. (default) Exploitz.com : regions : caribbean : netherlandsantilles : St Martin

to

2. (proposed mod) Exploitz.com : Regions : Caribbean : Netherlands Antilles : St Martin

In #1, the Name field is used for both displayed text and the url.

In #2, the mod I'm trying to do, the Meta Description field is used for the displayed text and Name is still used for the url.
Quote Reply
Re: [Andy] title_linked modification In reply to
Thought I'd bring this thread back up as Im looking to do something similar.

Andy, I tried your suggested sub but its returning this error:

Quote:
Unable to compile 'title_linked2': syntax error at (eval 36) line 9, near ""

What im hoping to do is add in keywords to the title_linked sub if any are listed in the category Table for that category, example:

Home : This Category Name Keywork1 keyword2 : page 3

As yogi suggests would I need to set that sub up to loop through the keyword colum (or in his example the meta name) for every category?

Thanks,

Charlie



Comedy Quotes - Glinks 3.3.0, PageBuilder, StaticURLtr, CAPTCHA, User_Edit_Profile

Quote Reply
Re: [Chas-a] title_linked modification In reply to
This might work;

Code:
sub {

my $title_linked = $_[0];
my $ID = $_[1];

my $cat_details = $DB->table('Category')->select( { ID => $ID } )->fetchrow_hashref;

my $keyword1 = $cat_details->{Keyword1};
my $keyword2 = $cat_details->{Keyword2};

my ($sliced1,$sliced2) =~ m|\Q<a href="\E(.*?)\Q">\E(.*?)\Q</a>\E|i;

my $new_linked = qq|<a href="$sliced1">$sliced2|;
$new_linked .= " $keyword1" if $keyword1;
$new_linked .= " $keyword2" if $keyword2;
$new_linked .= "</a>";

return $new_linked;

}

<%global_name($title_linked,$ID)%>

... Will only work on category pages (for obvious reasons =)).

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: Aug 27, 2004, 3:33 AM
Quote Reply
Re: [Andy] title_linked modification In reply to
Appriciate you helping with ths Andy! Smile

That global is returning a similar error:

Unable to compile 'title_linked2': syntax error at (eval 36) line 17, near ""

which would appear to be this line:

Code:
my $new_linked = "<a href="$sliced1">$sliced2";

Any ideas?

thanks!



Comedy Quotes - Glinks 3.3.0, PageBuilder, StaticURLtr, CAPTCHA, User_Edit_Profile

Quote Reply
Re: [Chas-a] title_linked modification In reply to
Eugh, another late one :(

It should read;

my $new_linked = qq|<a href="$sliced1">$sliced2|;

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] title_linked modification In reply to
That works except the original title_linked text for the link is missing eg.

Home : test keyword1 test keyword2

to be...

Home : Some category test keyword1 test keyword2

thanks,

Charlie



Comedy Quotes - Glinks 3.3.0, PageBuilder, StaticURLtr, CAPTCHA, User_Edit_Profile

Quote Reply
Re: [Chas-a] title_linked modification In reply to
Mmm.. how does the modified global work now? (I've changed a few things; so I'd suggest simply overwriting the old global).

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] title_linked modification In reply to
Like this:

Code:
sub {

my $title_linked = $_[0];
my $ID = $_[1];

my $cat_details = $DB->table('Category')->select( { ID => $ID } )->fetchrow_hashref;

my $keyword1 = $cat_details->{Keyword1};
my $keyword2 = $cat_details->{Keyword2};

my ($sliced1,$sliced2) =~ m|\Q<a href="\E(.*?)\Q">\E(.*?)\Q</a>\E|i;

my $new_linked = qq|<a href="$sliced1">$sliced2|;
$new_linked .= " $keyword1" if $keyword1;
$new_linked .= " $keyword2" if $keyword2;
$new_linked .= "</a>";

return $new_linked;

}

and returns:

Home : keyword1 keyword2



Comedy Quotes - Glinks 3.3.0, PageBuilder, StaticURLtr, CAPTCHA, User_Edit_Profile

Quote Reply
Re: [Chas-a] title_linked modification In reply to
Mmm.. what if you change it from;

my ($sliced1,$sliced2) =~ m|\Q<a href="\E(.*?)\Q">\E(.*?)\Q</a>\E|i;

...to;

my ($sliced1,$sliced2) = $title_linked =~ m|\<a href\=\"(.*?)\"\>(.*?)\<\/a\>|i;

?

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] title_linked modification In reply to
Hi Andy,

Here's what your changed code returns on the first page...

<a href="link to home page">Home : Keyword1 Keyword2</a>

and page 2, page 3 etc.

<a href="link to home page">Home : Keyword1 Keyword2</a>


Here's what im hoping to setup...

<a href="link to home page">Home</a> : Category name Keyword1 Keyword2

and page 2, page 3 etc.

<a href="link to home page">Home</a> : <a href="link to this category">Category name Keyword1 Keyword2</a> : Page 2

thanks fella!

Charlie



Comedy Quotes - Glinks 3.3.0, PageBuilder, StaticURLtr, CAPTCHA, User_Edit_Profile

Quote Reply
Re: [Andy] title_linked modification In reply to
Andy, I take it you dont know of a way to do this?

thanks,

Charlie



Comedy Quotes - Glinks 3.3.0, PageBuilder, StaticURLtr, CAPTCHA, User_Edit_Profile

Quote Reply
Re: [Chas-a] title_linked modification In reply to
In Reply To:
Andy, I take it you dont know of a way to do this?

Afraid not (if I spent enough time on it I could.. but I'm really busy at the moment with other jobs/plugins Unimpressed).

Sorry

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!