Jump to content

Share content across 2 sites


Peter Knight
 Share

Recommended Posts

Hi guys

Is it possible to have a PW site display content from another PW site?

I've been reading about ProcessWire's Multi-site options and I don't think either is a way forward for me.

Both PW sites are separate installs with separate databases but crucially they are on the same VPS. So I'm hoping that's a good thing.

Basically, Site A has approx 100 reviews consisting of these fields

  • Reviewer name
  • Review
  • Date

Instead of setting up the fields onto Site B and duplicating work and creating 100 pages, I want to *somehow* get site B to use a selector to fetch the necessary content from Site A.

In future, if I need to update the reviews, I can goto the 'source' Site A to do this.

 

Link to comment
Share on other sites

I wouldn't explore multi-site anymore. You could spit out a feed from site A and read it on site B. You could even import them into site B. I am on mobile right now, but we do this quite regularly so could post an example when I am in the office. RSS, XML, lots of options. 

  • Like 1
Link to comment
Share on other sites

3 minutes ago, cb2004 said:

I wouldn't explore multi-site anymore. You could spit out a feed from site A and read it on site B. You could even import them into site B. I am on mobile right now, but we do this quite regularly so could post an example when I am in the office. RSS, XML, lots of options. 

Thanks. That all sounds good. 

Link to comment
Share on other sites

This should be quite easy using the bootstrapping feature of PW: https://processwire.com/docs/front-end/include/

Oops, wrong keyword, actually I wanted to link to multi-instance use of pw like @kongondo does in the next post ? 

You could then grab data from one install and show it on the other instance wherever you want.

4 hours ago, Peter Knight said:

they are on the same VPS. So I'm hoping that's a good thing.

Yes, for bootstrapping multi-instance that's a good thing ? 

  • Like 2
Link to comment
Share on other sites

I just tried out this multi-instance approach and Tracy returns this error:

E_COMPILE_ERROR: 
Cannot declare class ProcessWire\FieldtypeRepeater, because the name is already in use on line: 31 in 
/home/devsite/www/prototypen/instance-2/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module

Compile Error: Cannot declare class ProcessWire\FieldtypeRepeater, because the name is already in use (line 31 of /home/devsite/www/prototypen/instance-2/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module) 

This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.
$site = new ProcessWire('/home/devsite/www/prototypen/instance-2/', 'https://prototypen.devsite.com/instance-2/');
$home = $site->pages->get(1);
$homeUrl = $home->httpUrl;
$homeTitle = $home->title;
echo "<a href='$homeUrl'>$homeTitle</a>";

Path and URL are correct, and both PW sites are on the same server. I'm calling it from a PW 3.0.108 installation. Instance 2 is 3.0.126.

Weird.

Link to comment
Share on other sites

  • 5 years later...
On 3/8/2019 at 3:47 PM, dragan said:

I just tried out this multi-instance approach and Tracy returns this error:

E_COMPILE_ERROR: 
Cannot declare class ProcessWire\FieldtypeRepeater, because the name is already in use on line: 31 in 
/home/devsite/www/prototypen/instance-2/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module

Compile Error: Cannot declare class ProcessWire\FieldtypeRepeater, because the name is already in use (line 31 of /home/devsite/www/prototypen/instance-2/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module) 

This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.
$site = new ProcessWire('/home/devsite/www/prototypen/instance-2/', 'https://prototypen.devsite.com/instance-2/');
$home = $site->pages->get(1);
$homeUrl = $home->httpUrl;
$homeTitle = $home->title;
echo "<a href='$homeUrl'>$homeTitle</a>";

Path and URL are correct, and both PW sites are on the same server. I'm calling it from a PW 3.0.108 installation. Instance 2 is 3.0.126.

Weird.

Hey, did you ever find a solution to this?

I'm suffering with the same issue and can't find any solution to resolving this across the forum.

For context, both sites are using ProcessWire 3.0.229. When I connect to another site on 3.0.210 it works fine.

EDIT: Sadly I had to give up on this because I simply could not find the root of the issue - I can connect to other sites without issue but not this particular one. In the end I used file_get_contents and RIPEMD160 to create a hash from the e-mail address used on both sites (plus a secret token). That is working well.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...