Jump to content
Peter Knight

Share content across 2 sites

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.

 

Share this post


Link to post
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

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By humanafterall
      Hi,
      I'm looking at how I might achieve the following with Processwire:
      A low-bandwidth version of a website, on a subdomain (eg text.mydomain.com), where the content/database is exactly the same as the top level domain, but a new set of templates is used so the site is stripped back to just very simple CSS/low quality images.
      I'm looking and trying to work out what might be best — is it multi-site from the same database? Multi-instance? API? 
      Any guidance or experience of a similar setup would be much appreciated.
       
    • By Sébastien
      Hello everyone,
      I recently started using ProcessWire and already manage to accomplish several things on my own, but I keep asking myself a lot of questions, among which the following:
      After installing a multiple sites version (first method), everything works for now as desired, but I realize that all the files seem accessible by all the domains.
      Let's say that site1.com can access the asset files, template or other ressources of site2.com folders and vice versa by specifying only and for example:
      site1.com/path_to_a_site2_folder/one_file
      or
      site2.com/path_to_a_site1_folder/one_file
      Would you know if there is a simple way to prohibit this kind of behavior in order to clearly distinguish each site and thus ensure the confidentiality and separation of content?
      I prefer to avoid the entities to be considered as a single set by crawlers and prevent access the elements belonging to each domain from another domain.
      Thanks for your help. Sébastien.
    • By Liam88
      Hi All,
      New user over at Processwire and have been rebuilding my site based on this CMS.
      I have been able to find so many answers through Google but I'm a little stuck on this one.
      I have my services page -> services categories -> category children.
      An example of those would be - domain -> services -> ppc -> management
      I also have a set of tags which have different names - services-tag -> grow-your-traffic
      Under these tags I would have multiple links to pages such as ppc, seo, social media and so on.
      A second example would be - services-tag -> convert-your-traffic
      Under here i would have multiple links to pages such as CRO
      Now the set of tags are not visible on-site as they are only created to give overview content to the main services categories.
      Using the categories and the tags I am looking to produce a layout such as (i have also attached an image as an example:
      Tag_1 headline
      Pull all services categories linking to Tag_1
      Tag_1 snippet
      Tag_2 headline
      Pull all services categories linking to Tag_2
      Tag_2 snippet
      So far I have this snippet which is pulling in the tag content but unable to get the posts to show under each of the tags. 
      If i change the if and statement to "tags" instead of "tag" then all posts show under all tags. Where as i want it to show only the posts which are linked to that tag.
      <?php namespace ProcessWire; $tags = $pages->get("/categories-services/")->children(); // Gets the tags $posts = $pages->get("/services/")->children(); // Gets the services categories $link = $tags->ref_6; // Gets the tags and services categories link - under here you have pages_id (services cat id) and data (tags id) // Tag header and summary foreach($tags as $tag) { // This breaks down the tags into sections echo '<section id="services"> <div class="container"> <div class="row"> <h2 class="heading-1"><span>'. $tag->headline.'</span></h2> <p class="mb-5">'. $tag->summary.'</p> </div> <div class="row justify-content-around services">'; // Main services categories that link to the above tags if ($posts->id === $link->pages_id && $tag->id === $link->data){ foreach($posts as $service){ // This pulls in the services categories under the tag header. echo '<div class="card flex-card" id=""> <div class="card-img"> <a href="/'. $service->name.'" title="'. $service->name .'"> <img class="card-img-top" src="../assets/files/'. $service->id.'/'. $service->img_1.'" alt="'. $service->img_1.'" title="'. $service->img_1.'"></a> </div> <div class="card-body"> <h3 class="card-title">'. $service->headline.'</h3> <p class="card-text">'. $service->summary .'</p> <div class="card-action"> <a href="" title="'. $service->name .'" role="link" class="link">View service<span></span></a> </div> </div> </div> '; } } // Grey snippet text echo '</div> </div> </section> <div class="snip-2 light-grey"> <div class="container"> <div class="row text-center">'. $tag->get('grey') .'</div> </div> </div>'; } ?> I appreciate this is a long post but i'm trying to be clear as I appreciate everyone's time.
      Any insight into where I am going wrong is greatly appreciated.
      Liam



    • By iipa
      Hi everybody!
      I have been reading about Multisite, but it kinda bugs me that every topic talks about having both admin and database same for multiple sites.
      I have a project where customer tests it by adding content to the site, while I still need to do some changes here and there in code, maybe some in database. If something crashes for a while, customer can't keep testing, which is a bit problematic.
      Is there any way that I could have two separate versions of one site ("production" and development) that share the same database, but are otherwise independent? Just the thought of having to migrate database every time I want to show client something new gives me anxiety 😁
    • By sins7ven
      Hi community, I am wondering if its possible to display languages based on what host/domain has been requested.
      The use case is the following: I have one installation of PW - and within this installation I set up 5 different languages (default, english, spanish, french, dutch). Now I have 3 different domains (domainA.com, domainB.com, domainC.com) and I want to decide which languages to make available based on what domain has been navigated to. 
      For example:
      domainA.com
       - default (domainA.com)
       - english (domainA.com/en)
      domainB.com
        - default (domainB.com)
        - french (domainB.com/fr)
        - dutch (domainB.com/nl)
      domainC.com
        - default (domainC.com)
        - dutch (domainC.com/nl)
      So what I want to achieve is making only these particular languages selectable in the language switcher on the frontend. Since all pages share the same templates and overall site structure I don't see the benefits of running this installation as a multisite setup or would it be better to do so? But I assume that this would be difficult to handle since the default language might change as well. (On the french version of the page, french should be the default language and so on). Any suggestions how to accomplish that? Thanks!
×
×
  • Create New...