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

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...