This module has been deprecated as part of Zikula 4 slimming diet.
The Multisites module.
Please check the 1.x branch for the version for Zikula 1.x!
- Introduction
- Requirements
- Installation
- Upgrading
- Configuration
- Structure and management
- Creating and adapting sites
- Questions, bugs and contributing
The Multisites module allows to create and use a huge number of websites for arbitrary purposes and clients. Beside normal "main" sites you can also run other relevant pages, like for example for multiple retail stores, sales partners or landing pages for specific topics.
It is possible to manage any number of projects for multiple clients. Each project can thereby contain any number of sites. By using site templates you can easily reuse structure, content as well as layouts and functionality across multiple sites.
This module is intended for being used with Zikula 2.0.15+.
The Multisites module is installed like this:
- Copy the content of
modules/
into themodules/
directory of your Zikula installation. Afterwards you should have two folder namedmodules/Zikula/MultisitesModule/
andmodules/Zikula/SubsiteModule/
. - Copy the content of app/Resources/ into the /app/Resources folder of your Zikula site.
- Initialize and activate ZikulaMultisitesModule in the extensions administration.
- Move or copy the directory
Resources/userdata/ZikulaMultisitesModule/
to/web/uploads/ZikulaMultisitesModule/
. Note this step is optional as the install process can create these folders, too. - Make the directory
/web/uploads/ZikulaMultisitesModule/
writable including all sub folders.
Note the Multisites module should only be installed and activated at the main page. This repository also contains a second module, ZikulaSubsiteModule
, which is required to be enabled for all sites except the main page.
The upgrade process from 1.0.x to 2.0.0 and from 2.0.0 to 2.1.0 has been implemented. It has not been tested throughly yet though (please report your experience).
Also when updating to 2.1.0 you need to manually update app/config/dynamic/generated.yml
and adjust the Multisites properties following the values in your old /config/mutisites_config.php
. The old configuration files are not used anymore, because the whole /config
directory is gone in Zikula 2.x.
When entering the Multisites administration area you will be redirected to a configuration wizard automatically.
- Example: client xy
- A project serves for grouping websites for a certain client or topic.
- A project can contain multiple site templates.
- A project can contain multiple sites.
- Examples: central website, community portal, sales partner page
- Each site template represents the blueprint for multiple sites.
- Each site template includes a sql file containing it's structure and data. This involves all created content pages, user permissions and much more.
- After a site has been created it's database can be exported in order to reuse it as site template for other sites afterwards.
- A site template can be available either for all or just for specific projects.
- Example: community portal xy
- Each site is assigned to a project and based on a certain site template.
- Each site gets a unique name as well as a domain or subdomain.
- A site carries more data, like credentials for the database and for the primary admin user.
- For each site you can upload a logo as well as a favicon image.
- Each site is equipped with a dedicated databases (for reasons of architecture and scalability). It is also possible to let multiple sites work with the same database. This requires corresponding customisations in the used theme though.
- The Multisites backend offers a quick search function to find a certain site quickly.
- A site template can define parameters. These correspond to a variable piece of information which must be entered for each site based on this template. For example a template describing sites for sales partners could require parameters for the address, contact data and other individual data.
- The detail page of a template documents the existing parameters to make this information transparent.
- The parameter values for a certain site can be uploaded using a csv file. The first table column contains the parameter name (e. g. LASTNAME), the second column contains the value for the edited site. Alternatively you can also enter these values by hand using a form.
- When creating or editing a site which is going to be used as a template you can use placeholders which are replaced by the parameter values of sites based on the template in the final output of a page. Parameter values are also provided as module variables (see below for more details).
- New layouts are placed in a central place in the system (themes/ folder).
- Layouts can centrally inspected and activated for each site.
- Which layouts are available and which ones are initially active for a site is controlled as part of the underlying site template.
- Examples: News, Forums, Guestbook, etc.
- New modules are placed in a central place in the system (modules/ folder).
- Modules can centrally inspected and activated for each site.
- Which modules are available and their states for a site is controlled as part of the underlying site template.
When a site is initially created the database is filled with the assigned template's data. After that the CMS delivers this site as soon as it gets called by the configured domain.
During the site creation all parameters are replaced using their deposited values. This approach makes the initialisation process repeatable.
To duplicate an already created site you can use the corresponding database as a basis for a new site template. This new template can then be used for creating further sites, like described above.
To amend a site template change the site which was used to create the template initially. Edit the site's structure and content until it meets your requirements. Afterwards the database is exported again and the resulting sql file is uploaded again into the site template.
Site templates can be copied to change them and store them with a new name. Site parameter definitions are considered and included during the copy process.
It is possible to reapply a site template which has been updated before to all sites based on this template. After approving a confirmation question the initialisation process is performed again for all affected sites ("reset"). This includes overriding of existing content, unless specific database tables have been added to the list of table names to be excluded in the template data. You can even use wildcards here, for example you can exclude all Content tables by using "content_*".
It is also possible to decouple selected sites from their template. As soon as the assignment is removed this site is not affected anymore when the template is reapplied, but is independently configured and maintained. If a decoupled site is reassigned to a site template, this template is applied to it's database like described above.
By using template plugins it is possible to represent variants within one layout theme. Therewith you can use a theme for multiple sites. All data, variables and settings can be part of individual logic thereby. This particularly includes the site parameters mentioned above. So if you for example have three sites for different cities can check the content of the city parameter for design-related decisions.
For this reason all parameter values are provided as module variables during the site initialisation process.
Use in code files:
$city = $variableApi->get('ZikulaSubsiteModule', 'parameterValueCity', 'default value');
if ($city == 'Berlin') {
echo '<h2>Hello Berlin</h2>';
}
Use in templates:
{% set city = getModVar('ZikulaSubsiteModule', 'parameterValueCity', 'default value') %}
{% if city == 'Munich' %}
<h2>Hello Munich</h2>
{% endif %}
If you want to report something or help out with further development of the Multisites module please refer to the corresponding GitHub project at https://github.com/zikula-modules/Multisites.