Welcome Guest, Not a member yet? Register   Sign In
How to use the same app for multiple identical websites, with different configuration
#1

(This post was last modified: 09-20-2022, 02:33 AM by serialkiller.)

I'm trying to upgrade my CI3 multi-user application to version 4, I don't have big problems rewriting all the code to version 4, but I don't know how to solve the structure problem.

The old application is structured like this, I have a "CI_CORE" folder that contains the "app" folder and the various files that were needed for version 3 and then a folder for each website as a webroot that contains the "index.php" and others useful files and folders, including the assets folder which is virtualized.

What is all this for?
Each website is identical in all respects to the others, it is a sort of management system, so they are the same in the structure, what changes are the name of the DB, the DB access credentials and a whole series of local settings, in this way if there are changes, upgrades or bug fixes just upload the changes in the "CI_CORE" folder and these will be reflected on all websites, same thing for the "assets" which is a virtualized folder, so also here, uploading any changes, these will affect all websites.

To use the same structure in CI3 just change the path of the "app" folder in the index.php file and point to the site folder as webroot.

Also another problem is the local configurations, in CI3 there is the config.php file which is nothing more than a set of values enclosed in an array, to add local confuguration values just include the site configuration file used at the end of the file config.php to add local configuration values based on your website.

How can I go about achieving the same result in CI4?

Basically I should go through this structure

Code:
- CI_CORE
  |
  |_ app
  |_ system


- www.website-1.com
  |
  |_ index.php
  |_ session
  |_ local_config
  |_ local_log

- www.website-2.com
  |
  |_ index.php
  |_ session
  |_ local_config
  |_ local_log

- www.website-3.com
  |
  |_ index.php
  |_ session
  |_ local_config
  |_ local_log

- ... and so on

to something like this
Code:
- CI_CORE
  |
  |- app
  |- builds
  |- composer.json
  |- composer.lock
  |- preload.php
  |- spark
  |- test
  |- vendor
  |- writable
  |- ... all other files


- www.website-1.com
  |
  |_ index.php
  |_ local_config
  |_ local_log

- www.website-2.com
  |
  |_ index.php
  |_ local_config
  |_ local_log

- www.website-3.com
  |
  |_ index.php
  |_ local_config
  |_ local_log

- ... and so on

Or in any other way that leads to the result.

I looked here: https://www.codeigniter.com/user_guide/g..._apps.html

but it is not my case, except for some changes that I might need, like changing the path of the app folder if necessary
Reply
#2

this is what I loaded up to my live web for CI4.2.6

Code:
kursaal.org
├── app
├── public
├── vendor
└── writable
vendor has extra stuff added like PHPMailer

public has :

Code:
[[email protected]:http/kursaal2.org]$ tree -L 1 public                                                        (09-21 15:24)
public
├── blogImages
├── captcha
├── css
├── favicon.ico
├── fonts
├── galleryImages
├── images
├── index.php
├── js
├── minCss
├── productImages
├── robots.txt
├── sitemap.xml
└── sounds
I use Arch Linux by the way 

CMS in Action
Reply
#3

(09-21-2022, 07:25 AM)captain-sensible Wrote: this is what I loaded up to my live web for CI4.2.6

Code:
kursaal.org
├── app
├── public
├── vendor
└── writable
vendor has extra stuff added like PHPMailer

public has :

Code:
[[email protected]:http/kursaal2.org]$ tree -L 1 public                                                        (09-21 15:24)
public
├── blogImages
├── captcha
├── css
├── favicon.ico
├── fonts
├── galleryImages
├── images
├── index.php
├── js
├── minCss
├── productImages
├── robots.txt
├── sitemap.xml
└── sounds

I'm trying to have a single app folder for different websites, basically it's like having multiple public folders with different names for different websites that use the same structure (controller, model, view, etc., etc.)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB