-Test |
+The following is used when you want to create multiple bitweaver sites using the same install, but possibly different databases. |
+ |
+A simple ''kernel/config_inc.php'' looks something like this: |
+{CODE()}<?php |
+global $db_tiki, $host_tiki, $user_tiki, $pass_tiki, $dbs_tiki; |
+$db_tiki = "pgsql"; |
+$host_tiki = "localhost"; |
+$user_tiki = "tiki"; |
+$pass_tiki = "mypasswd"; |
+$dbs_tiki = "mydb"; |
+define( 'TIKI_DB_PREFIX', '' ); |
+define( 'TIKI_ROOT_URL', '/bitweaver/' ); |
+?>{CODE} |
+ |
+This allows a single configuration for the code base. If we would like to have other configurations, we would have to add some smarts to the ''kernel/config_inc.php'', so that it can redirect each request appropriately. |
+ |
+Imagine we have two sites setup using virtual hosting, __site1__ and __site2__. We can configure config_inc.php as follows: |
+{CODE()}<?php |
+global $db_tiki, $host_tiki, $user_tiki, $pass_tiki, $dbs_tiki, $tikidomain; |
+$db_tiki = "pgsql"; |
+$host_tiki = "localhost"; |
+$user_tiki = "tiki"; |
+$pass_tiki = "mypasswd"; |
+$dbs_tiki = "mydb"; |
+define( 'TIKI_ROOT_URL', '/' ); |
+switch ($_SERVER["HTTP_HOST"]) { |
+ case "site1": |
+ define( 'TIKI_DB_PREFIX', 'site1.' ); |
+ $tikidomain = "site1"; |
+ break; |
+ case "site2": |
+ define( 'TIKI_DB_PREFIX', 'site2.' ); |
+ $tikidomain = "site2"; |
+ break; |
+} |
+} |
+?>{CODE} |
+ |
+As mentioned on the ((bitweaver and ((bitweaver and ((bitweaver and ((bitweaver and ((bitweaver and ((bitweaver and ((bitweaver and ((bitweaver and ((bitweaver and TikiWiki)) Page [http://tikiwiki.org/AkiraMultiTiki] - you can use a similar method without using virtual hosting. I haven't tried this yet, but the coding would look something like this. |
+{CODE()}<?php |
+global $db_tiki, $host_tiki, $user_tiki, $pass_tiki, $dbs_tiki, $tikidomain; |
+$db_tiki = "pgsql"; |
+$host_tiki = "localhost"; |
+$user_tiki = "tiki"; |
+$pass_tiki = "mypasswd"; |
+$dbs_tiki = "mydb"; |
+switch ( extractTopPath( $SCRIPT_URL ) ) { |
+ case '/site1/': |
+ define( 'TIKI_DB_PREFIX', 'site1.' ); |
+ define( 'TIKI_ROOT_URL', '/site1/' ); |
+ $tikidomain = "site1"; |
+ break; |
+ case "/site2/": |
+ define( 'TIKI_DB_PREFIX', 'site2.' ); |
+ define( 'TIKI_ROOT_URL', '/site2/' ); |
+ $tikidomain = "site2"; |
+ break; |
+} |
+ |
+function extractTopPath( $in ) { |
+ if ( ( $point = strpos( substr( $in, 1 ), "/" ) ) === false ) { |
+ return ( $in . "/" ); |
+ } else { |
+ return substr( $in, 0, $point + 2 ); |
+ } |
+} |
+?>{CODE} |