Using ZN Framework it is possible to develop more than one project linked to each other on the same installation at the same time.
If your host allows multiple domain names, you can run different domains or subdomains on the same structure. With common file usage, you do not need to copy or re-write the same files and directories again for each project, using the same library, model, source, language, configuration files for all of your projects.
To do this, the other domains and subdomains must first be set to show the directory where ZN is installed. In your project you will have to make several adjustments to run more than one application. the directory setting in the following setting file is used. This setting is defined as an array and specifies which application to run for which host.
|String||$ default = 'Frontend'||Which of the project directories in Projects / directory to run as default.|
|Array||$ others = ||This lattice specifies which host name will run which project directory. However , if you are using the same named project directory as the host name, you do not need to make such a definition.|
|Array||$ containers = ||It is used to refer to one of the projects so that other projects can be connected to the main project. That is, the subprojects pull the files belonging to non-self-directories from the main project directory that they refer to.|
# Projects Directory ( ZN >= 3.1.3 )
As a rule, you can call the directories under Projects / array as follows.
Assuming we have a project directory structure like the following;
If you assume that your projects are the same as above, use the address bar to run these directories;
format. You need to know that these directories specify the physical location of the directory names can not be used in the process of punctuation .
You can give project directories nicknames for use on the URL.
othersYou can edit the setting for this as follows.
'others' => [ 'admin' => 'Admin', 'forum' => 'Forum' ]
After these settings, you can use the address bar to run;
You can specify the host name as well as specify the nickname for the others key in the configuration file. This is necessary for different or subdomain uses. If you are using the directory name with the same name as the host name, you do not need to do the following definition .
'others' => [ 'subdomain.example.com' => 'SubdomainExample', 'www.otherexample.com' => 'OtherExample' ]
You need to set the Apache's DocumentRoot value in the httpd.conf files created for each domain to point to the main directory of ZN so that the above mentioned hosts can run the specified directory, ie different or subdomains on the same system .
# Linking Projects
An application can be referenced and linked to the application for which other applications are referenced. Thus multiple applications use the common directories of an application. That is, if you want to share common directories such as Config / , Libraries / , Models / , Languages / , Resources / for Frontend / and Backend / directories , you can use the containers array in the configuration file .
|Array||$ containers = [ 'Backend' => 'Frontend' ]||It is used to refer to one of the projects so that other projects can be connected to the main project. That is, the subprojects pull the files belonging to non-self-directories from the main project directory that they refer to.|
As you can see from the above, 2 applications can be run as if they were in the same directory .
Looking at the Projects / Backend / directory, we can only see the Controllers / , Views / and Storage / directories. The fact that this directory is designed this way indicates that it is included in the Frontend / directory. In other words , the files of all other directories not in the backend / directory are extracted from the Frontend / directory. The main purpose of this use is to connect multiple subdomains on the same system. Rather than copying the same files for each domain again, it links projects together and saves you from additional file overload. The project directories of znframework.com are listed below.
The following shows how some of the above directories are linked to each other.
'directory' => [ 'default' => 'Frontend' 'others' => [ 'forum.znframework.com' => 'Forum', 'docs.znframework.com' => 'Docs', 'api.znframework.com' => 'Api' ] ], 'containers' => [ 'Forum' => 'Frontend', 'Docs' => 'Frontend', 'Api' => 'Frontend' ];
As seen in the above configuration, there are no other internal directories outside the internal directories that differ by connecting to the Frontend / directory. Thus, copying the same directory and files one by one prevents each of the blocked changes from being applied individually.
Projects can be made in modular mvc designs thanks to the ability to link one to another. For this you need to replicate each directory that you create as modular to include the Models-Views-Controllers directories. Here is an example configuration.
In the above directory structure , the submodules designed to contain the directories contained in the Home Frontend / directory must be designed to contain only the Models-Views-Controllers directories. After this, the following configuration should be done in the containers configuration.
'directory' => [ 'default' => 'Home' 'others' => [ 'products' => 'Products', 'appointments' => 'Appointments' ] ], 'containers' => [ 'Products' => 'Home', 'Appointments' => 'Home' ];
If you copy your configuration file to other directories Home / we have arranged that it will be included in the index.