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

create new variable of domain from URL

(Page 2 of 2)
> >
Quote Reply
Re: [tandat] create new variable of domain from URL In reply to
The plugins I have installed are :

Adcycle 2.15
Bad_Links 2.2.1a
Category_Adverts 3.2
SimpleGlobal 1

Do you mean the hook 'display_link' (not 'link_display')? If so, I see it inside the 'hooks.cfg' file inside Plugins. It has the lines:

Code:
'display_link' => [
{
'subroutine' => 'Links::Link::HTML::display',
'hook_name' => 'display_link',
'filename' => '(eval 4)',
'input_params' => [
'HASH'
],
'output_params' => [
'SCALAR'
],
'description' => '',
'line' => '42',
'path' => './Plugins'
},
{
'subroutine' => 'Links::Link::HTML::display',
'filename' => '(eval 14)',
'hook_name' => 'display_link',
'input_params' => [
'HASH'
],
'description' => '',
'output_params' => [
'SCALAR'
],
'line' => '20',
'path' => './Plugins'
},
{
'subroutine' => 'Links::Link::HTML::display',
'hook_name' => 'display_link',
'filename' => '(eval 4)',
'input_params' => [
'HASH'
],
'output_params' => [
'SCALAR'
],
'description' => '',
'line' => '91',
'path' => './Plugins'
},
{
'subroutine' => 'Links::Link::HTML::display',
'hook_name' => 'display_link',
'filename' => '(eval 13)',
'input_params' => [
'HASH'
],
'output_params' => [
'SCALAR'
],
'description' => '',
'line' => '27',
'path' => './Plugins'
}
],
Quote Reply
Re: [yo Huge] create new variable of domain from URL In reply to
Yes, I meant the hooks but you can look at the Plugins/plugins.cfg file. I don't know much about the hooks.cfg

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] create new variable of domain from URL In reply to
Nope, the Plungins/plugin.cfg file only has the hooks 'display_link' PRE and POST for SimpleGlobal
Quote Reply
Re: [yo Huge] create new variable of domain from URL In reply to
Is there a Links plugin that tests if the hooks 'PRE' and 'POST' are working and returning the correct variables?
Quote Reply
Re: [yo Huge] create new variable of domain from URL In reply to
You can set a test site to test that.

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] create new variable of domain from URL In reply to
I switched all the 'display_link' and 'display_link_pre' to 'form_link' and 'form_link_pre' in plugin.cfg and SimpleGlobal.pm and it was the same result when viewing the modify link page inside the admin area - the plugin works, no errors, but it shows a blank $domain value. Is there an alternative to this part of the code that would grab the current link's URL value some other way and place it between the brackets?

Code:
my $domain = remove_leading_http($link->{URL});


Do any of these have anything to do with it not working?
Perl version: 5.8.8
Gossamer Links version: 3.3.0
GT::Template version: 2.172
Running under mod_perl: No
Running under SpeedyCGI: No

Apache/2.2.14 (Unix)
mod_ssl/2.2.14
OpenSSL/0.9.8e-fips-rhel5
mod_bwlimited/1.4
PHP/5.3.1

Last edited by:

yo Huge: Mar 23, 2013, 11:49 PM
Quote Reply
Re: [yo Huge] create new variable of domain from URL In reply to
It should not rely on those. What are the page the domain does not have value?

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] create new variable of domain from URL In reply to
In Links admin I select 'Database' and then on the left I select 'Links' and 'List All' and press 'GO' and this page loads in the frame showing each link record followed by the word 'Domain:' and no value after it


Code:
/links/admin/admin.cgi?keyword=*&Username=&ID=&ReviewID=&do=search_results&ID-opt=%3D&Username-opt=%3D&ReviewID-opt=%3D&db=Links&todo=search_results&keyid=
Quote Reply
Re: [yo Huge] create new variable of domain from URL In reply to
You're right. It is empty on glinks 3.3.x. My testing is on glinks 3.2.x Let me see what happened there. Or some other plugins cause that. The current version is not correct. Please use this one. So, the glinks' versions does not matter.

Cheers,

Dat

Programming and creating plugins and templates
Blog

Last edited by:

tandat: Mar 24, 2013, 3:05 AM
Quote Reply
Re: [tandat] create new variable of domain from URL In reply to
COOL! It works - yes, that version works now so i guess it was my links ver 3.3 that has some coding changes from ver 3.2 that affected SimpleGlobal. THANKS!
Quote Reply
Re: [yo Huge] create new variable of domain from URL In reply to
In case you were wondering why on earth would I need the domain displayed from each link it's because I need to solve a link verifying problem. When I run 'verify links', if a site is no longer there and it's domain has gone back to its registrar, the registrar's default domain park page is displayed and so there wouldn't be an error 'page not found' and it wouldn't show up in the 'Bad Links' section in verify links results. I would just assume the site was still active there (unless I visited every site manually). So what I did is run an open source program called Thumbpage, a web page thumbnail generator using a text file of all my links and set it to grab a 640x480 screenshot of each site and save it to my PC in the format 'domain.com.png'. Then I uploaded them all to an image directory inside the admin section on my site. So with your plugin, I was able to change this line of code in SimpleGlobal.pm:

Code:
return qq|$out<br><br>Domain:&nbsp;&nbsp;$domain|;

To this:

Code:
return qq|$out<br><img src="/thumbs/$domain.png" width="640" height="480" />|;

Now when I view 'database' 'links' 'list all', every link in the database automatically matches up to its screenshot PNG file which is now shown under each link listing. So at a glance I can now see if a link is a real website or a domain park page and delete it. I just run the thumbpage program once a month. This way, I only have large screenshots of every site in the admin section, not thumbnails in the public section, which is what I wanted to do for now. Thanks again!
Quote Reply
Re: [yo Huge] create new variable of domain from URL In reply to
Also, if I did want to see the live site for each link listed, I would just change it to this:

Code:
return qq|<br><iframe src="$link->{URL}" scrolling="yes" width="1024" height="768" frameborder="0"></iframe><br>$out|;
> >