Databases

The default Database

flatCore stores nearly all data in SQLite3 databases. These are located in the directory /content/SQLite/.

Use more than one database

To use one flatCore installation on different domains, it is possible to distribute the content in different databases. The default database file is located in /content/SQLite/content.sqlite. To access multiple databases, you can proceed as follows.

  1. Duplicate the file content.sqlite3 and rename it.
  2. Create or modify the file /content/config.php to Determine when and which the database is active (see the Example below).

Example:

// File /content/config.php
// Databases
$fc_content_files = array (
 array (
 'file' => 'content.sqlite3',
 'desc' => 'Default SQLite Database'
 ),
 array (
 'file' => 'content_copy.sqlite3',
 'desc' => 'Just a Copy'
 )
);

In the Backend you can choose now which database is currently active. You can change the database at any time.

Now you can define your rules for the frontend.

Example:

// File /content/config.php
if($_SERVER['HTTP_HOST'] == 'subdomain.example.com') {
   $fc_db_content = FC_CONTENT_DIR . "/SQLite/content_copy.sqlite3";
}

In the database file content.sqlite3 are stored the following contents:

  • RSS-Feeds
  • All Pages
  • Snippets
  • Preferences

The user database user.sqlite3 remains unaffected. So all Admin/User-Accounts are active in both (or more) installations.