Webmastersite.net
Register Log In

Sharing link details between two sites.

Comments on Sharing link details between two sites.

webflair
Forum Regular

Usergroup: Customer
Joined: Nov 27, 2006

Total Topics: 187
Total Comments: 465
Posted Feb 21, 2009 - 8:51 AM:

Say you have two links directories, lets call them site a and site b.

Site a has a category called "Accommodation" and has an established list of links in that category.

Then I create a category on Site b also called accommodation, and rather than creating a new set of links, I want to you use the information I already have on site a for that category.

What is the best, and easiest way to either... Import the links from the "accommodation" category on site a to the "accommodation" category on site b. Or altenatively, display the info from site a on site b, by sharing a database between the two sites.

I realise that by sharing a database I can display links from site a, on site b, using a toplist, but the problem with that is the link details page for site b, will open the details page for site a, plus site b will not be searcheable that way.

I thought about automatically creating XML files using custom templates with no wrapper and a toplist, then importing the xml file to site b. Problem is, using the xml import in the admin panel, if I imoport a link that is already in the link directory, will it create a dulicate link?

Any ideas on the best way to share links between two directories?
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Feb 21, 2009 - 10:30 AM:

There's no easy way to share a single category. I believe mysql's INSERT...SELECT syntax would be the key to importing, but I've never used it before. Something like

INSERT INTO desination_links (*)
SELECT *
FROM source_links WHERE catid=x;

I think. Replacing x with the desired catid. Though that'd require the category use the same id numbers on both sites. That would insert duplicates however, so you'd have to run the duplicate checker after the query.

I guess another solution would be to use phpmyadmin to copy the table to a temporary one, remove the id column, download a .sql file of links where catid=x, use a text editor to change the catid number to the new desired one, and then upload the result to the destination table.

Of course, these importing methods are one-time and don't sync up when the original site data changes.

Problem is, using the xml import in the admin panel, if I imoport a link that is already in the link directory, will it create a dulicate link?

Depends on your duplicate prevention settings selections. If you have it set to prevent duplicate submissions then it should exclude them. However, it won't update changes to existing listings.
webflair
Forum Regular

Usergroup: Customer
Joined: Nov 27, 2006

Total Topics: 187
Total Comments: 465
Posted Feb 21, 2009 - 11:07 AM:

Is it possible to have two installs share the same links and categories table in mysql? If so then I can use toplists to filter the displayed categories and links in site b.

I know you used to be able to tell the script which table to use for each item in config.php, but that no longer seems to be the case.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Feb 22, 2009 - 4:12 PM:

Seems to not be possible anymore, it just auto-loads every table with the specified prefix.

For the knowledge bases I use all the same tables and just a different set of files/templates and a tweak to override the 'censor' values.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.