A single eZ publish installation is capable of hosting multiple sites by making use of something called the siteaccess system. This system makes it possible to use different configuration settings based on a set of rules. The rules control which group of settings that should be used in a particular case. The siteaccess rules must be specified in the global override for the site.ini configuration file ("/settings/override/site.ini.append.php").
A collection of configuration settings is called a siteaccess. When a siteaccess is in use, the default configuration settings will be overridden by the settings that are defined for the siteaccess. Among other things, a siteaccess dictates which database, design and var directory that should be used (these are sometime referred to as "resources"). By making use of different siteaccesses, it is possible to combine different content and designs. A typical eZ publish site consists of two siteaccesses: a public interface for visitors and a restricted interface for administrators. Both siteaccesses use the same content (same database and same var directory) but they use different designs. While the administration siteaccess would most likely use the built in administration design, the public siteaccess would use a custom design. The following illustration shows this scenario.
Example of a setup with two siteaccesses.
A siteaccess is nothing more than a set of configuration files that override the default settings when the siteaccess is used. A single eZ publish installation can virtually host an unlimited number of sites by the way of siteaccesses. The configuration settings for a siteaccess are located inside a dedicated subdirectory within the "/settings/siteaccess" directory. The name of the subdirectory is the actual name of the siteaccess. (Please note that siteaccess name should only contain letters, digits and underscores.) The following illustration shows a setup with two siteaccesses: admin and public.
Siteaccess directory example.
When a siteaccess is in use, eZ publish reads the configuration files using the following sequence:
- Default configuration settings (/settings/*.ini)
- Siteaccess settings (/settings/siteaccess/[name_of_siteaccess]/*.ini.append.php)
- Global overrides (/settings/override/*.ini.append.php)
In other words, eZ publish will first read the default configuration settings. Secondly, it will determine which siteaccess to use based on the rules that are defined in the global override for "site.ini" ("/settings/override/site.ini.append.php"). When it knows which siteaccess to use, it will go into the directory of that siteaccess and read the configuration files that belong to that siteaccess. The settings of the siteaccess will override the default configuration settings. For example, if the siteaccess uses a database called "Amiga", the system will see this and automatically use the specified database when an incoming request is processed. Finally, eZ publish reads the configuration files in the global override directory. The settings in the global override directory will override all other settings. In other words, if a database called "CD32" is specified in the global override for "site.ini" then eZ publish will attempt to use that database regardless of what is specified in the siteaccess settings. If a setting is not overridden by either the siteaccess or from within a global override then the default setting will be used. The default settings are set by the ini files located in the "/settings" directory. The following figure illustrates how the system reads the configuration files using the "site.ini" file as an example. As already mentioned, settings placed in the override files will be used instead of the default ones.
Configuration override example.
Balazs Halasy (01/02/2005 3:27 pm)
Svitlana Shatokhina (28/02/2006 3:53 pm)