Peter,
Concerning your first question.
For the multiple install method i'll explain the process I take:
1) install CMSMS in your web root and in an appropriate directory for the language, ie: /home/www/cmsms/en
2) create /images and /uploads directory in web root, ie: /home/www/cmsms/images & /home/www/cmsms/uploads
3) set permissions
4) when installing set you database prefix to ie: "en_"
5) build complete website for one language
After you have finished the English version, say you want to have a Portuguese version.
1) copy /home/www/cmsms/en to /home/www/cmsms/pt
2) edit config.php to indicate new path
3) duplicate all tables with prefix en_ to pt_
for this last task I wrote a small web page that uses a php script to detect every table starting with a defined prefix, duplicate all of them and add new prefix, so if I had a table say en_content, it would be duplicated to pt_content.
My reasoning for doind this was simply a matter of not having one database for each language. This wasy each language can be in the same database. Also dont forget to change the prefix in config.php!
index.html
------------------
Code: Select all
<__html>
</__body>
<form action="db.php" method="get">
<label>
Database: <input type="text" name="db" /><br />
</label>
<label>
Username: <input type="text" name="uname" /><br />
</label>
<label>
Password: <input type="text" name="pass" /><br />
</label>
<label>
Prefix: <input type="text" name="prefix" /><br />
</label>
<label>
New Prefix: <input type="text" name="new_prefix" /><br />
</label>
<input type="submit" value="Go!" />
</form>
<__body>
</__html>
PHP Script
------------------
Code: Select all
<?php
$db_host = 'localhost';
$db_database = $_GET["db"];
$db_username = $_GET["uname"];
$db_password = $_GET["pass"];
$prefix = $_GET["prefix"];
$new_prefix = $_GET["new_prefix"];
// Connect
$connection = mysql_connect( $db_host, $db_username, $db_password );
if (!$connection)
{
die ("Could not connect to the database: <br />". mysql_error());
}
// Select the database
$db_select=mysql_select_db($db_database);
if (!$db_select)
{
die ("Could not select the database: <br />". mysql_error());
}
// Assign the query
$query ="SHOW TABLES";
// Execute the query
$result = mysql_query( $query );
if (!$result)
{
die ("Could not query the database: <br />". mysql_error());
}
// Fetch and display the results
$i =1;
while ($result_row = mysql_fetch_row(($result)))
{
if (strlen($prefix)== 4) { // ie "cms_"
$tb_prefix = substr($result_row[0], 0, 4); // get tabel prefix 4chars
$tb_name = substr($result_row[0], 4); // get table name begining from 4th char
}
elseif (strlen($prefix)== 3) { //ie "pt_"
$tb_prefix = substr($result_row[0], 0, 3); // get tabel prefix 3chars
$tb_name = substr($result_row[0], 3); // get table name begining from 3rd char
}
if ($tb_prefix == $prefix) { // if table prefix is equal to prefix you want to change
echo 'Prefix: '.$tb_prefix. '<br />';
echo 'Table '.$i.' name: '.$tb_name . '<br /><br />';
$query2 = "CREATE TABLE ".$new_prefix.$tb_name." LIKE ".$prefix.$tb_name;
mysql_query( $query2 );
$query3 = "INSERT ".$new_prefix.$tb_name." SELECT * FROM ".$prefix.$tb_name;
mysql_query( $query3 );
}
$i++;
}
//Close the connection
mysql_close($connection);
?>
Note: The first prefix (the one you want to change) can only be two or three characters! (ie_ cms_ or pt_) Also allways include the "_" after the prefix.!
PS: Please be warned that I am no PHP expert! This PHP script is by no means perfect! Use at your own risk. I shall not be responsible for any damage, loss of work, etc..
Word of advice: Don't use this unless you are sure of the risks!