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

Links in DB

(Page 1 of 2)
> >
Quote Reply
Links in DB
Hi,

Been looking for this and havent been able to find it in the message base.
Does anyone have a plugin (ahem, andy) that will link specific words from the database?

For example the word "Hosting". The plugin would search the entire database in description for that word and link it to something we want.

word:hosting link:http://www.gossamerhost.com
word:Anti-Virus link:http://www.norton.com

and so on...

Anyone?

Thanks,
Juan Carlos
Quote Reply
Re: [Gorospe] Links in DB In reply to
Hi,

You could probably do it with a global;

replace_words_with_links

Code:
sub {

my @words = split /\n/, q|some word::http://www.domain.com
another::http://www.google.com|;

my $tmp = $_[0];
foreach (@words) {
my ($word,$link) = split /::/, $_;
$tmp =~ s|\b$word|<a href="$link" target="_blank">$word</a>|sig;
}
return $tmp;
}


..then just use something like this:

<%replace_words_with_links($Description)%>

Untested, but something like that should do the trick =)

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] Links in DB In reply to
Hmmm its doing something... but not sure if I got my point across...

What its doing is simply getting text in the description field and placing it on my page, no link. It doesnt have to replace anything. Perhaps modify it.

Lets see if I can explain myself better.

Say in Description I have several paragraphs. Within those paragraphs I have the word Amazon. I want that word Amazon automaticly linked to amazon with my associate ID.

In the same paragraphs, I have the word IPOD, that word would automaticly be linked to say IPOD store.

The reason for making this as hot words is say I no longer want to link IPOD to that store, I want to link it elsewhere, I want a central point/place where that can be overwriten.

Hmmm did I explain myself?

Thanks
Juan Carlos
Quote Reply
Re: [Gorospe] Links in DB In reply to
So are you trying to change actual links (i.e that are in your data already), or converting words to links, with specific words?

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] Links in DB In reply to
convert words to links... via a central file or global.
Quote Reply
Re: [Gorospe] Links in DB In reply to
Hi,

And only on certain fields, or everything? If just certain fields, then that global I gave should work fine (it could be tweaked to use a MySQL table with the word/link inside it, which would mean you don't need to bother updating the global, but just the table instead)

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] Links in DB In reply to
In my case, just the Description field. Thats where the core of the page is located at.

Your global just outputed the content of the whole description field. No link.
Quote Reply
Re: [Gorospe] Links in DB In reply to
Can you put an example of your description here, along with some of the words/links you wanna use? That global I gave you should have done the trick (not tested it, due to time availablility - but should work none the less)

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] Links in DB In reply to
Ok, my description field (translated) would be something like:
-------------------------

In my clinic we treat deseases like:
  • HIV
  • Low count red cells
And we use techniques such as:
  • Kawa treatment
  • ABC pills.
  • ADN tests
---------------------------
And on another area of my site I have a glossary of these terms. So id like to link say HIV to its defenition, ABC Pills to a pharmacy and ADN tests to a lab.

The idea its not new, Im looking for something that many websites use, which is to hiperlink certain words to outside files or sites.
Amazon uses a javascript, and links to books, movies etc on their site automaticly from yours.
Some other sites have advertising pop up dhtml box... Like when you talk about a router, the word router is hyperlinked to a little popup "Buy a router" ad.
Im just looking for a central unified place to "ADN Tests:http://www.adnlab.com" (or similar) where keyword is "ADN Tests" so it creates an automatic link to a specific URL containing the ADN Tests defenition or explanation.

The code you gave me, when I place it in the detailed.html, just copies the entire Description field on the page with no links.

Thanks andy. I think this would be a great plugin for advertising keywords and affiliate programs. So you may want to look into it further.

Juan Carlos
Quote Reply
Re: [Gorospe] Links in DB In reply to
Can you paste the global you are trying to use? (may be an issue with the way you are entering the words to replace)

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] Links in DB In reply to
replace_words_with_links

sub {

my @words = split /\n/, q|CGI::http://www.cgi.com
google::http://www.google.com|;

my $tmp = $_[0];
foreach (@words) {
my ($word,$link) = split /::/, $_;
$tmp =~ s|\b$word|<a href="$link" target="_blank">$word</a>|sig;
}
return $tmp;
}

placing <%replace_words_with_links($Description)%> in detailed.html

JC
Quote Reply
Re: [Gorospe] Links in DB In reply to
Mmm.. try adding some debugging in.

..before:

Code:
$tmp =~ s|\b$word|<a href="$link" target="_blank">$word</a>|sig;

..add:

Code:
print qq|Word: $word , link: $link <br />|;

..and see if what that prints out.

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] Links in DB In reply to
Ok, it did link the word this time exactly as I want.
One thing, If its outpoutting the whole detaled field, Im guessing I should replace my own <%detaled%> field. :)

Ok, got it, its working.
Should I leave the new line in there?
Quote Reply
Re: [Gorospe] Links in DB In reply to
Hi,

Yeah, just replace <%Detailed%> with the new tag (I thought it should be working fine Whistle)

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] Links in DB In reply to
Hi Andy,

Quote:
(it could be tweaked to use a MySQL table with the word/link inside it, which would mean you don't need to bother updating the global, but just the table instead)

You think of making a plugin ? Smile

There would be other options possible ?

Thanks,

Mick
Quote Reply
Re: [MJ_] Links in DB In reply to
Maybe Tongue

To be honest, I've just undertaken a pretty large job (can't divulge any details I'm afraid ;)), so most of my week is gonna be taken up with that. If I get a bit of free time, I'll see what I can do =)

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] Links in DB In reply to
Hi Andy,

Quote:
To be honest, I've just undertaken a pretty large job
I am happy for you... Smile

It is not urgent for me, but I think that would be very useful... and that would also give the possibility of paying you for your contribution.

Mick


Quote Reply
Re: [MJ_] Links in DB In reply to
What kind of features would you be looking at wanting in this plugin? Just having a think about maybe trying to make it today - in a bit of spare time I've got :)

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] Links in DB In reply to
Ok, here are some ideas:

1) You can assign certain words to specific categories (or "all" categories)
2) For each link, you can specify multiple words (seperated by comma)
3) If being used on category.html, you can invoke:

<%SponsorText::GetAdvertsForCat($Description,$category_id)%>

...and on detailed pages, use:

<%SponsorText::GetAdvertsForDetailed($Description,$ID)%> (this is cos it will need to lookup the catID for the link in question, to find the right words)

It will also have a basic admin interface, for setting up new words / editing current ones.

That sounds feature packed enough? Its pretty limited in terms of what can actually be done with this kinda plugin really =)

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] Links in DB In reply to
Heres the first version:

http://gossamerlinks.com/...t_1%2Findex.html;d=1

..and a different one:

http://gossamerlinks.com/...t_6%2Findex.html;d=1

Just gotta do some kinda admin area, so you can administer the words/links easily :)

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] Links in DB In reply to
Hi Andy,

That seems very interesting. Smile
It will be possible to give a title and to indicate if the link is of type _blank or _parent (...) ?

Another question.

I tried to use it with another global, but I did not succeed.

Code:
sub {
my $field_content = $_[0];
$field_content = GT::CGI::html_escape($field_content);
$field_content =~ s|\n|<BR>\n|g;
$field_content =~ s,\[([/\w\s#"=;:{}]+)\],<$1>,g;
return $field_content;
}


http://www.gossamer-threads.com/...?post=263845#p263845

You think that it is possible with your plugin only for the detail page ?

Thanks,

Mick

Last edited by:

MJ_: Nov 3, 2008, 10:21 AM
Quote Reply
Re: [MJ_] Links in DB In reply to
Hi,

Quote:
It will be possible to give a title and to indicate if the link is of type _blank or _parent (...) ?

I don't see why not :)

Quote:
I tried to use it with another global, but I did not succeed

What exactly is that global mean't to do?

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] Links in DB In reply to
I made an error on the link of origin.

This global makes it possible to format description.

I use on my detail page :
<%global($FieldNameToFormat)%>

Here the link of origin :
http://www.gossamer-threads.com/...?post=263845#p263845

And on my page of category I use another global :
<%field_short($Description,'260')%>

You think that it will be possible to make compatible your new plugin with these different Globals ?

Thanks,

Mick

Last edited by:

MJ_: Nov 3, 2008, 10:36 AM
Quote Reply
Re: [MJ_] Links in DB In reply to
Ah right - yeah, that should be possible. Just do:
Code:
<%set Description2 = field_short($Description,'260')%>

...then for my plugin, use:

Code:
<%Plugins::SponsorText::GetAdvertsForLink($Description2,$ID)%>

:)

BTW, the plugin is now finished - but I still need to write the documentation etc, so will leave that til tomorrow - as its almost 7pm here now Smile

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] Links in DB In reply to
Just a last suggestion.

It would be perfect if it were possible to use a style (css) for the link.

Good end of evening. Smile

Mick

Last edited by:

MJ_: Nov 3, 2008, 10:43 AM
> >