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

How to display owner links from a second installation

Quote Reply
How to display owner links from a second installation
I'm struggling a bit here.

I have 2 copies of links tied together with community.

I want to display the owners links from one installation on their detailed page in the other installation.

So far I have found a global to display an owners links on the detailed page with

Code:
sub {
my $user = $_[0];
my $sth = $DB->table('Links')->select( { LinkOwner => $user, isValidated => 'Yes' } ) || return $GT::SQL::error;
my $back; while (my $hit = $sth->fetchrow_hashref) { $back .= Links::SiteHTML::display('link', $hit); } return $back; }



and this displays the owners link fine but of course from the wrong installation.

I have spent a couple of hours searching but can't find an answer that works to pull the links from the other installation.
The two installations are on the same domain.

Any help would be appreciated as I'm not an expert in perl :(

Cheers

Andy
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Hi,

Mmm.. ok - lemme try and understand what your asking.

You have 2 installations. For example sake, say Install1 and Install2.

Now, in these installs the user "test" has 5 links - 3 in one installation, and 2 in another.

Lets say:

Install1:
Link a
Link b
Link c

Install2:
Link x
Link y

..so for example, on "Link a" on "Install 1" you want a global, which will grab the links from the other installation - by the same user (test)

..is that correct? (its not exactly a simple thing to do - so wanted to be sure first Tongue)

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] How to display owner links from a second installation In reply to
Hi Andy and thanks for the help,

You pretty much have it I think.

Basically Install1 has people's listings

Install2 is another copy where people can add articles about attractions and towns and as an incentive I want to include their listing from Install1
on the detailed pages they add in Install2

Cheers

Andy
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Hi,

Ok cool. Basically - which ever site you wanna show the links from, you need to add this global:


load_users_other_links
Code:
sub {

my $user = $_[0];

my $NEWDB = new GT::SQL (
def_path => '/path/to/Install2/admin/defs',
cache => 0,
debug => 0,
subclass => 0
);

my $tbl = $NEWDB->table('Links');
$tbl->select_options('ORDER BY Title');

my @loop;
my $sth = $tbl->select( { LinkOwner => $_[0], isValidated => 'Yes' } ) || die $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
if ($CFG->{build_detailed}) {
$hit->{detailed_url} = 'http://www.yoursite.com/path/to/detailed/' . $DB->table('Links')->detailed_url( $hit->{ID} );
}
push @loop, $hit;
}

return { users_other_links => \@loop }
}

Call with:

Code:
<%load_users_other_links($LinkOwner)%>
<%if users_other_links.length%>
<%loop users_other_links%>
<%include link.html%>
<%endloop%>
<%endif%>

You need to change the bits in red, in the global. Hopefully they make sense as to what they are for =)

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] How to display owner links from a second installation In reply to
Hi Andy,

I really appreciate it.

Thanks for that. It has worked a treat and I have the correct links showing.

This is the new URL
http://www.chambresdhotes.org/...nces/Detailed/1.html

The original link comes from here
http://www.chambresdhotes.org/...de_Chambres_D_Hotes/

The only problem I can see is the detailed url doesn't seem to be picking up the ID and also the other links in link.html have the installation2 directory name in them. Any way to correct this?

Thanks again

Cheers

Andy
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Hi,

My appologies - instead of:

Code:
$hit->{detailed_url} = 'http://www.yoursite.com/path/to/detailed/' . $DB->table('Links')->detailed_url( $hit->{ID} );

..you need:

Code:
$hit->{detailed_url} = 'http://www.yoursite.com/path/to/detailed/' . $NEWDB->table('Links')->detailed_url( $hit->{ID} );

Hopefully 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] How to display owner links from a second installation In reply to
Hi Andy

Sorry but it doesn't seem to have made any difference Blush

Andy
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Mmm odd - what if you change it to a hard-coded URL?

i.e

$hit->{detailed_url} = "http://www.yoursite.com/Detailed/$hit->{ID}.html"

???

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] How to display owner links from a second installation In reply to
I have the following now

Code:
sub {
my $user = $_[0];
my $NEWDB = new GT::SQL (
def_path => '/var/www/cgi-bin/links/admin/defs',
cache => 0,
debug => 0,
subclass => 0
);

my $tbl = $NEWDB->table('Links');
$tbl->select_options('ORDER BY Title');

my @loop;
my $sth = $tbl->select( { LinkOwner => $_[0], isValidated => 'Yes' } ) || die $GT::SQL::error; while (my $hit = $sth->fetchrow_hashref) {
if ($CFG->{build_detailed}) {
$hit->{detailed_url} = 'http://www.chambresdhotes.org/Detailed/' . $NEWDB->table('Links')->detailed_url( $hit->{ID} );
}
push @loop, $hit;
}
return { users_other_links => \@loop }
}

I tried

Code:

sub {
my $user = $_[0];
my $NEWDB = new GT::SQL (
def_path => '/var/www/cgi-bin/links/admin/defs',
cache => 0,
debug => 0,
subclass => 0
);

my $tbl = $NEWDB->table('Links');
$tbl->select_options('ORDER BY Title');

my @loop;
my $sth = $tbl->select( { LinkOwner => $_[0], isValidated => 'Yes' } ) || die $GT::SQL::error; while (my $hit = $sth->fetchrow_hashref) {
if ($CFG->{build_detailed}) {
$hit->{detailed_url} = 'http://www.chambresdhotes.org/Detailed/$hit->{ID}.html' . $NEWDB->table('Links')->detailed_url( $hit->{ID} );
}
push @loop, $hit;
}
return { users_other_links => \@loop }
}

which didn't work...not sure if that is exactly what you meant Blush
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Hi,

The 2nd one is what I'm thinking along the lines of.

Try this:

Code:
$hit->{detailed_url} = "http://www.chambresdhotes.org/Detailed/$hit->{ID}.html";

...instead of :

Code:
$hit->{detailed_url} = 'http://www.chambresdhotes.org/Detailed/$hit->{ID}.html' . $NEWDB->table('Links')->detailed_url( $hit->{ID} );

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] How to display owner links from a second installation In reply to
Fantastic

That seems to have worked. Smile

Now I'm just left with the link to the contact form and my thumbnail
http://www.chambresdhotes.org/...nces/Detailed/1.html

Do I just add another line like this?


I get the feeling that's not going to work Blush
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Hi,

Glad that worked =)

Not sure what you mean about the image / contact page?

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] How to display owner links from a second installation In reply to
If you look at

http://www.chambresdhotes.org/...nces/Detailed/1.html


in the link.html that comes from installation1

there is a link to jump.cgi
also a link to the contact form
and also a thumbnail image.

they all seem to be referencing the right id but they have

vacances in the url instead of

links

should be this:
http://www.chambresdhotes.org/cgi-bin/links/jump.cgi?ID=21


but is showing this
http://www.chambresdhotes.org/cgi-bin/vacances/jump.cgi?ID=21


Cheers

Andy
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Hi,

I expect its something to do with using the link.html template

Try changing:

<%include link.html%>

...to:

<%include link2.html%>

..and copy the contents of link.html into the "links2.html" template - and then change references to the <%config.db_cgi_url%> and <%config_build_root_url%> to their respective URLs, on the other installation.

For example - change:

Code:
<%config.db_cgi_url%>/jump.cgi?ID=<%ID%>

...to:

Code:
/cgi-bin/links/jump.cgi?ID=<%ID%>

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] How to display owner links from a second installation In reply to
That's great.

I'm a bit embarrassed that I didn't think of that. Blush I was trying to change link.html in the wrong installation Smile

The only problem i'm left with is the path to thumbnail

<%Image1_thumbnail_path%>

Can't see any way to do the same thing with that Frown

Anyway...thanks for all your help Andy

I was really stuck on this.

Cheers

Andy
Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
heheh np - happens to the best of us Wink

Regarding:

<%Image1_thumbnail_path%>

..is that a global yop have setup on the main install?

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] How to display owner links from a second installation In reply to
Smile

It is the slideshow plugin from gossamer

I have done a template dump at
http://www.chambresdhotes.org/...nces/Detailed/1.html

and for
<%Image1_thumbnail_path%>


it is showing
http://www.chambresdhotes.org/...back-accueil-new.jpg


there is also a

SlideShowCache there

which has the correct path in it

Code:
{
'Image1' => 'http://www.chambresdhotes.org/links/images/1/51-pool2large.jpg',
'Image1_large' => 'http://www.chambresdhotes.org/links/images/7/57-large_pool2large.jpg',
'Image1_largest' => 'http://www.chambresdhotes.org/links/images/6/60376-largest_pool2large.jpg',
'Image1_medium' => 'http://www.chambresdhotes.org/links/images/6/56-medium_pool2large.jpg',
'Image1_thumbnail' => 'http://www.chambresdhotes.org/links/images/9/49-thumbnail_pool2large.jpg',
'Image2' => 'http://www.chambresdhotes.org/links/images/5/55-img_0633.jpg',
'Image2_large' => 'http://www.chambresdhotes.org/links/images/2/52-large_img_0633.jpg',
'Image2_largest' => 'http://www.chambresdhotes.org/links/images/8/60378-largest_img_0633.jpg',
'Image2_medium' => 'http://www.chambresdhotes.org/links/images/8/58-medium_img_0633.jpg',
'Image2_thumbnail' => 'http://www.chambresdhotes.org/links/images/0/50-thumbnail_img_0633.jpg',
'Image3' => 'http://www.chambresdhotes.org/links/images/0/60-img_0617.jpg',
'Image3_large' => 'http://www.chambresdhotes.org/links/images/3/53-large_img_0617.jpg',
'Image3_largest' => 'http://www.chambresdhotes.org/links/images/7/60377-largest_img_0617.jpg',
'Image3_medium' => 'http://www.chambresdhotes.org/links/images/4/54-medium_img_0617.jpg',
'Image3_thumbnail'


but I'm not sure how I would use that? Have you come across this before?

Cheers

Andy


Quote Reply
Re: [chapelier] How to display owner links from a second installation In reply to
Hi,

Mmm.. never used the GT SlideShow plugin I'm afraid - so not really sure, sorry Pirate

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] How to display owner links from a second installation In reply to
Hi,

No worries,

You have been more than helpful thanks. I'll work out some way to substitute vacances for links somehow Wink


Cheers

Andy