Jump to content
apeisa

Multisite

Recommended Posts

This seems to be more tricky than I initially thought it would be. Will investigate this.

Share this post


Link to post
Share on other sites

Sounds like I'm going to need this module. But I have a few questions:

I'm a big fan of the XML sitemap plugin.. anyone have experiences using these two plugins together?

Are urls like http://domain/subdomain/article redirected to http://subdomain.domain/article 

if someone hovers the link does it show http://domain/subdomain/article ? or http://subdomain.domain/article ?

Share this post


Link to post
Share on other sites

From memory the XML sitemap class doesn't check for multisite needs, though I seem to recall someone asking this before and maybe even posting some altered code (I might have dreamed that bit thouugh!).

Share this post


Link to post
Share on other sites

Can I use and test out this module locally ie. using MAMP?

Some basic instructions would be great!

Also if I use it on a live host can I install processwire with the multisite module in a subfolder before I move it into the root?

Share this post


Link to post
Share on other sites

I don't use MAMP, but what you have to basicly is this:

1) Install ProcessWire with for example the domain maindomain.localhost which points to /Arjen/Sites/maindomain.com/.

2) Make sure it's working fine and install the Multisite plugin.

3) Create an entry in your virtual host file and point that domain to the domain in step 1. For example point seconddomain.localhost to /Arjen/Sites/maindomain.com/ as well.

4) Now both maindomain.localhost and seconddomain.localhost will load the same website.

5) Follow instructions above.

Share this post


Link to post
Share on other sites

I have pretty mixed feelings about this module myself. It does work (well, there is one user where it doesn't and I don't have a clue why), but all should be aware that there are many things to consider:

  • Complexity grows exponentially with each subsite you add. More templates, more fields, more pages
  • Your coding needs to be different if the site is subsite: $page->rootParent isn't actually rootParent, but the home. 
  • www.campaign-site.com/processwire/ admin isn't there, it is only at www.main-site.com/processwire/
  • Maybe not compatible with all the modules. Ie. form builder works, but you need to create new /form-builder/ page under each of your subsites.
  • Cross linking doesn't work yet. Ie. if you use get or find to find pages from other subsites, then echo $p->url() won't give the right url (this is should be actually easy fix, but not yet fixed)

If your subsite is big, I don't think using this module is good idea. For simple marketing campaign sites I think this is fine way to go, but for larger sites I would consider other approaches.

  • Like 2

Share this post


Link to post
Share on other sites

only the homepage of the subdomain works for me.

if I try go to:

subdomain.site.com/yadayada/

nothing happens. see:

corporate.ccw-global.com

www.ccw-global.com

Edit: I ended up moving the subdomain back to having it's own database. It might be more hassel to admin, but simpler to ensure good SEO with two different XML sitemaps. I had a few instances where /domain/subdomain/ due to the way pages were linked.

Anyways, I'll look forward to when this module gets beefed up, or when a next gen version gets released.

Share this post


Link to post
Share on other sites

I think we should consider a new module which covers some more functions. The concept of contexts in MODX for example is pretty straight forward (in theory). So I think something like this would be nice to have:

- define any desired rootParent as own context

- every context can have its own context settings (for example domain or even own alias with the same domain as the root, language, id of own 404 etc.)

- In your templates you could just refer to these settings via $context->my_setting

- the url creation has to be implemented with a hook (path::after?) so it works everywhere

- cross context linking should work (so TinyMCE has to tweaked I guess)

- fields, templates etc. can be shared between contexts (organisation via the new tag function)

- [...]

I think it is a very common use case to have several websites (domains) in one environment, so this would be awesome if we would have a module which considers all these "problems" and would work out of the box. So we could claim PW as "multi language, multi domain" without tweaking  ;)

Unfortunately this is beyond my PHP skills :-

  • Like 1

Share this post


Link to post
Share on other sites

The aims seem to be:

  • One site folder
  • One templates folder (which is where it gets messy)
  • One admin interface
  • Potential to share information across sites by calling something like $pages->context('sitename')->find('selector'); - This is the best way I can think of making it work anyway

I'm trying to do this without the time to draw a diagram, but the way I would see a new module working would be something like this:

  1. Have a single wire folder
  2. Have a /site/contexts/ folder, each site has its own folder within containing templates for that context (that way you could ignore the original templates folder)
  3. Write some API code to do something like $pages->context('sitename')->find('selector');
  4. DON'T show all the sites in one tree in the admin - no need, just have a drop-down at the top-right somewhere to switch between contexts
  5. Give them the option NOT to share the same database if desired. This then caters for marketing mini-sites to share the same DB but larger sites to be separate, as well as allowing for complete separation of templates and fields if desired (useful for creative studios with many sites)

This addresses all the requirements I think. There are a few compromises, but this ticks off the main aims I listed and doesn't over-complicate matters.

What do you guys think? MODx contexts made my brain hurt so I'm throwing this idea out as something that's hopefully simpler to setup, understand and manage :)

Other considerations are:

  1. You need some way of having single sign-on to switch between contexts (let's just call them sites hey? I'm getting confused every time I type that :D) if you use the separate databases approach
  2. Someone needs to add some functions into the API to make this work the way I described above, but I think that's possible :)
  3. Also the selectors could just be like $site->get('sitename')->pages->find('selector') but I like my first idea better :P Maybe $pages->site('sitename')->find('selector') though since I've totally gone off the term "contexts" now.
  4. Of course if you don't specify the site() part then it will default to the site that the template file is in.#
  5. And anything else you can think of...
  • Like 1

Share this post


Link to post
Share on other sites

Okay, haven't read the entire thread so I may have this completely upside down, but isn't it easier to have multiple Site folders with the first one as a default?

So, in each subsequent site it will use the templates in its own folder if they exists, if not it uses the templates from the default folder. Same for modules and admin template. There would have to be some exceptions, probably, so you didn't end up with the head from your own site1 folder and the footer from the default site folder, for instance.

But it might make deleting sites easier if it is just removing their entire site folder. Also means that they could be transferred to another installation, I would think ... somehow.

  • Like 2

Share this post


Link to post
Share on other sites

Keep the ideas coming, I like what I read ...  :)

I totally like the site/sites approach for the files with fallback to the original site folder. So one could share common templates and also create individual ones.

Share this post


Link to post
Share on other sites
That is the exactly same bug that I haven't been able to solve yet. I am pretty sure it has something to do with server settings. It modifies the url fine, but still loads the homepage only. Strange. Does anyone have any clue about this? Also notice this: http://corporate.ccw-global.com/it/doesnt/throw/404/

yeah, I noticed... well since I switched back to 2 databases, that link now throws a 301 to the root :)

Share this post


Link to post
Share on other sites

The sites I was thinking of using this multisite module has mainly product pages that need to be shared. So if someone updates a product PDF file it is reflected on both sites. These product pages will have body text, couple of tables of data text, images to download and PDF files. There are also other downloadable files in other areas of the site, employee contact lists and resources that would ideally be shared too.

What options do i have to share content like this if multisite is not suitable?

Share this post


Link to post
Share on other sites

Simplest would be to use Ryan's web service module. It is pretty straightforward and we are here to help with it.

  • Like 1

Share this post


Link to post
Share on other sites

I have one question about method #1; Is there an easy way to keep all of the backend translation in one place (wire folder?). I have multiple sites, installed as written in method 1, which have their own (json) language files for the backend translation but they seem to be saved seperate within each site-folder. In my case this isn't necessary so I'm curious in which file to change the location where the language variables are retrieved.

Share this post


Link to post
Share on other sites

The language translation files are considered part of the site's files rather than ProcessWire's core files, so they have to live in /site/assets/files/.../ rather than anywhere else. I suppose you could always make a symlink to set them up somewhere else. But I wouldn't bother with that unless it's creating an obstacle to have them the way they are. 

Share this post


Link to post
Share on other sites

Hi Ryan, well in this scenario (multiple sites with the same backend), it's more convenient to have them stored and maintained in one place so when we add some 'core functionality' which should be available for all sites, it would be more time consuming to update all of the different language-folders instead of just one. But I'll look into a way to use the symlink-option, thanks ;)

  • Like 1

Share this post


Link to post
Share on other sites

I would like to use this module but my PW installation produces the same error which Arjen described on the first page:

I can reach the page using the following URL:

http://www.maindomain.com/www.seconddomain.com/testpage/
But I can't reach the page using this URL:

http://www.seconddomain.com/testpage/

I followed the step by step explanation he described but still have no success getting the module to work.

If I open subdomain1.domain.com it redirects to the correct path of the tree and renders the menu as it should. The menu contains links like subdomain1.domain.com/festival, which seems correct to me. But all those links lead to the home page of the current subdomain, so in this case subdomain1.domain.com.

I read the whole thread and learned that this module is far from perfect but I need a way to manage four subdomains which use nearly the same templates from one PW installation. There is no other convenient way except for this module, right?

Share this post


Link to post
Share on other sites

I'm not really sure why it might not be working in your case, but it definitely doesn't sound right. It reminds me a bit of what one sees if they are trying to run ProcessWire without an htaccess file. What version of ProcessWire? Also, double check that those links have a trailing slash in them. The one you mentioned did not have a trailing slash, and I suspect that this module would require them. 

Share this post


Link to post
Share on other sites

Hi Ryan,

the links added to the module settings do not have a trailing slash. However, if i add one the module stops working since it fails to match the entry to the appropriate page on the second level.

I do have a .htaccess file but I am currently running the page in a local environment via MAMP. I am using the current ProcessWire Version 2.3.0.

I don't know why this should be an issue, but I will perhaps try to run it on my web hosting to make sure it does not have a problem with running local.

Share this post


Link to post
Share on other sites

Ezeey, I experiencing the same behaviour as my previous post. Did you manage to get it up and running?

Could it be that a previous fix has been reversed? It doesn't seem so though when looking at the github history.

Share this post


Link to post
Share on other sites

Unfortunately I didn't. As I thought I am having the same issues no matter if the page is running local or on my remote server.

Share this post


Link to post
Share on other sites

I got it working, but it is very hackish and definately should be looked after. I will fork apeisa's code tomorrow and try to figure out why my current version does work and the latest on github won't. For now you can check if this gist works for you. It does for me. It's an old version of the module I installed on my local machine at home. Then I changed some code with the new version. I didn't fix one warning, just placed an @ before it to stop the warning.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      I am happy to present my new fieldtype FieldtypeImageFromPage. It is made up of 2 modules:
      Fieldtype Image Reference From Another Page is a Fieldtype that stores a reference to a single image from another page. The image can be selected with the associated Inputfield.
      Inputfield Select Image From Page is an Inputfield to select a single image from images on a predefined page and it's children.
      And there also is a helper module that takes care of cleanup tasks.
      This module evolved out of a discussion about my other Module FieldtypeImagePicker.  It caters for use cases where a set of images is being reused multiple times across a site. With this fieldtype these images can be administered through a chosen page. All images uploaded to that page will be available in the inputfield.
      When to use ?
      Let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site.
      Suited for images that are used on multiple pages throughout the site (e.g. icons).
      Other than the native ProcessWire images field, the images here are not stored per page. Only references to images on another page are stored. This has several advantages:
      one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Features
      Images can be manipulated like native ProcessWire images (resizing, cropping etc.) Image names are fully searchable through the API Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message to help you edit those pages and remove references there before you can finally delete the image. How to install and setup
      Download and install this module like any other modules in ProcessWire Create a page in the page tree that will hold your images. This page's template must have an images field Upload some images to the page you created in step 2 Create a new field. As type choose 'Image Reference From Another Page'. Save the field. In 'Details' Tab of the field choose the page you created in step 2 Click Save button Choose the images field name for the field that holds your images (on page template from step 2) Click Save button again Choose whether you want to include child pages of page from step 2 to supply images Add the field to any template You are now ready to use the field View of the inputfield on the page edit screen:

      View of the field settings

      The module can be installed from this github repo. Some more info in the README there, too.
      In my tests it was fairly stable. After receiving your valued feedback, I will eventually add it to the modules directory.
      My ideas for further improvement:
      - add ajax loading of thumbnails
      Happy to hear your feedback!
       
    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
×
×
  • Create New...