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

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/

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

Arjen, happy to know if you find anything.

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 d'Hinnisdaël
      Happy new year, everybody 🥬
      I've been sitting on this Dashboard module I made for a client and finally came around to cleaning it up and releasing it to the wider public. This is how it looks.
      ProcessWire Dashboard

      If anyone is interested in trying this out, please go ahead! I'd love to get some feedback on it. If this proves useful and survives some real-world testing, I'll add this to the module directory.
      Download
      You can find the latest release on Github.
      Documentation
      Check out the documentation to get started. This is where you'll find information about included panel types and configuration options.
      Custom Panels
      My goal was to make it really simple to create custom panels. The easiest way to do that is to use the panel type template and have it render a file in your templates folder. This might be enough for 80% of all use cases. For anything more complex (FormBuilder submissions? Comments? Live chat?), you can add new panel types by creating modules that extend the DashboardPanel base class. Check out the documentation on custom panels or take a look at the HelloWorld panel to get started. I'm happy to merge any user-created modules into the main repo if they might be useful to more than a few people.
       Disclaimer
      This is a pre-release version. Please treat it as such — don't install it on production sites. Just making sure 🍇
      Roadmap
      These are the things I'm looking to implement myself at some point. The wishlist is a lot longer, but those are the 80/20 items that I probably won't regret spending time on.
      Improve documentation & add examples ⚙️ Panel types Google Analytics ⚙️ Add new page  🔥 Drafts 🔥 At a glance / Page counter 404s  Layout options Render multiple tabs per panel panel groups with heading and spacing between ✅ panel wrappers as grid item (e.g. stacked notices) ✅ Admin themes support AdminThemeReno and AdminThemeDefault ✅ Shortcuts panel add a table layout with icon, title & summary ✅ Chart panel add default styles for common chart types ✅ load chart data from JS file (currently passed as PHP array) Collection panel support image columns ✅ add buttons: view all & add new ✅
    • By Pip
      Hi everyone!
      I'm trying out the Login/Register module for my site. Noted that the module assigns the newly registered user to login-register role. 
      Once you modify the login-register role's permissions, particularly adding page-edit, the new member role will be set to guest. 
      Thing is I'd like to grant my new users the power to create their own pages. Any advice? 
      Thanks. 
    • By Gadgetto
      SnipWire - Snipcart integration for ProcessWire
      Snipcart is a powerful 3rd party, developer-first HTML/JavaScript shopping cart platform. SnipWire is the missing link between Snipcart and the content management framework ProcessWire.
      With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop. The SnipWire plugin helps you to get your store up and running in no time. Detailed knowledge of the Snipcart system is not required.
      SnipWire is free and open source licensed under Mozilla Public License 2.0! A lot of work and effort has gone into development. It would be nice if you could donate an amount to support further development:

      Status update links (inside this thread) for SnipWire development
      2020-07-03 -- SnipWire 0.8.7 (beta) released! Fixes some small bugs and adds an indicator for TEST mode 2020-04-06 -- SnipWire 0.8.6 (beta) released! Adds support for Snipcart subscriptions and also fixes some problems 2020-03-21 -- SnipWire 0.8.5 (beta) released! Improves SnipWires webhooks interface and provides some other fixes and additions 2020-03-03 -- SnipWire 0.8.4 (beta) released! Improves compatibility for Windows based Systems. 2020-03-01 -- SnipWire 0.8.3 (beta) released! The installation and uninstallation process has been heavily revised. 2020-02-08 -- SnipWire 0.8.2 (beta) released! Added a feature to change the cart and catalogue currency by GET, POST or SESSION param 2020-02-03 -- SnipWire 0.8.1 (beta) released! All custom classes moved into their own namespaces. 2020-02-01 -- SnipWire is now available via ProcessWire's module directory! 2020-01-30 -- SnipWire 0.8.0 (beta) first public release! (module just submitted to the PW modules directory) 2020-01-28 -- added Custom Order Fields feature (first SnipWire release version is near!) 2020-01-21 -- Snipcart v3 - when will the new cart system be implemented? 2020-01-19 -- integrated taxes provider finished (+ very flexible shipping taxes handling) 2020-01-14 -- new date range picker, discount editor, order notifiactions, order statuses, and more ... 2019-11-15 -- orders filter, order details, download + resend invoices, refunds 2019-10-18 -- list filters, REST API improvements, new docs platform, and more ... 2019-08-08 -- dashboard interface, currency selector, managing Orders, Customers and Products, Added a WireTabs, refinded caching behavior 2019-06-15 -- taxes provider, shop templates update, multiCURL implementation, and more ... 2019-06-02 -- FieldtypeSnipWireTaxSelector 2019-05-25 -- SnipWire will be free and open source Plugin Key Features
      Fast and simple store setup Full integration of the Snipcart dashboard into the ProcessWire backend (no need to leave the ProcessWire admin area) Browse and manage orders, customers, discounts, abandoned carts, and more Multi currency support Custom order and cart fields Process refunds and send customer notifications from within the ProcessWire backend Process Abandoned Carts + sending messages to customers from within the ProcessWire backend Complete Snipcart webhooks integration (all events are hookable via ProcessWire hooks) Integrated taxes provider (which is more flexible then Snipcart own provider) Useful Links
      SnipWire in PW modules directory SnipWire Docs (please note that the documentation is a work in progress) SnipWire @GitHub (feature requests and suggestions for improvement are welcome - I also accept pull requests) Snipcart Website  

       
      ---- INITIAL POST FROM 2019-05-25 ----
       
    • By Sten
      Hello
      Till now I hacked something with the twig template but it works no more with new PW versions so I look forward to create a module. I am working on a site in multiple languages : French, English, Italian, German, Spanish, Portuguese, Hebrew, Russian. The new posts are entered in any language with a field for language. Till now, I got twig files to get the translations with constants defined for each part of the pages.
      So I'd like to create a module to include theses files added according to the url /fr/en/...
      Have you some observations to do before I begin about the direction to take ?
      Thank you
    • By ukyo
      Mystique Module for ProcessWire CMS/CMF
      Github repo : https://github.com/trk/Mystique
      Mystique module allow you to create dynamic fields and store dynamic fields data on database by using a config file.
      Requirements
      ProcessWire 3.0 or newer PHP 7.0 or newer FieldtypeMystique InputfieldMystique Installation
      Install the module from the modules directory:
      Via Composer:
      composer require trk/mystique Via git clone:
      cd your-processwire-project-folder/ cd site/modules/ git clone https://github.com/trk/Mystique.git Module in live reaction with your Mystique config file
      This mean if you remove a field from your config file, field will be removed from edit screen. As you see on youtube video.
      Using Mystique with your module or use different configs path, autoload need to be true for modules
      Default configs path is site/templates/configs/, and your config file name need to start with Mystique. and need to end with .php extension.
      Adding custom path not supporting anymore !
      // Add your custom path inside your module class`init` function, didn't tested outside public function init() { $path = __DIR__ . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR; Mystique::add($path); } Mystique module will search site/modules/**/configs/Mystique.*.php and site/templates/Mystique.*.php paths for Mystique config files.
      All config files need to return a PHP ARRAY like examples.
      Usage almost same with ProcessWire Inputfield Api, only difference is set and showIf usage like on example.
      <?php namespace ProcessWire; /** * Resource : testing-mystique */ return [ 'title' => __('Testing Mystique'), 'fields' => [ 'text_field' => [ 'label' => __('You can use short named types'), 'description' => __('In file showIf working like example'), 'notes' => __('Also you can use $input->set() method'), 'type' => 'text', 'showIf' => [ 'another_text' => "=''" ], 'set' => [ 'showCount' => InputfieldText::showCountChars, 'maxlength' => 255 ], 'attr' => [ 'attr-foo' => 'bar', 'attr-bar' => 'foo' ] ], 'another_text' => [ 'label' => __('Another text field (default type is text)') ] ] ]; Example:
      site/templates/configs/Mystique.seo-fields.php <?php namespace ProcessWire; /** * Resource : seo-fields */ return [ 'title' => __('Seo fields'), 'fields' => [ 'window_title' => [ 'label' => __('Window title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'attr' => [ 'placeholder' => __('Enter a window title') ] ], 'navigation_title' => [ 'label' => __('Navigation title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'showIf' => [ 'window_title' => "!=''" ], 'attr' => [ 'placeholder' => __('Enter a navigation title') ] ], 'description' => [ 'label' => __('Description for search engines'), 'type' => Mystique::TEXTAREA, 'useLanguages' => true ], 'page_tpye' => [ 'label' => __('Type'), 'type' => Mystique::SELECT, 'options' => [ 'basic' => __('Basic page'), 'gallery' => __('Gallery'), 'blog' => __('Blog') ] ], 'show_on_nav' => [ 'label' => __('Display this page on navigation'), 'type' => Mystique::CHECKBOX ] ] ]; Searching data on Mystique field is limited. Because, Mystique saving data to database in json format. When you make search for Mystique field, operator not important. Operator will be changed with %= operator.
      Search example
      $navigationPages = pages()->find('my_mystique_field.show_on_nav=1'); $navigationPages = pages()->find('my_mystique_field.page_tpye=gallery');
×
×
  • Create New...