English (United Kingdom)
Jms Multi Site, formerly joomla multisite.
Create, share multiple joomla sites in few clicks !
Message
  • EU e-Privacy Directive

    This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

    View e-Privacy Directive Documents

Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottomPage: 1
TOPIC: Slave site table prefix
#9557
Slave site table prefix 12 Years, 2 Months ago Karma: 0
I am writing a component that updates its tables with an Ajax routine. How do I find the table prefix for a site from the Ajax-php script. Is there a table that has site names and corresponding table prefix?
mokelly1
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9568
Re: Slave site table prefix 12 Years, 1 Month ago Karma: 54
If your Ajax perform a standard joomla initialization, the table prefix can be retreive from the $table_prefix = JFactory->getConfig( "config.dbprefix"); or from the $DB connection.

If you do not perform a standard Joomla initialisation, you have to add it.

See the Joomla "index.php" file to get inspired of the initialisation.

The code depends on your joomla version (1.5 or 2.5).

In 2.5, the correct joomla initialization is

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';

You just have to change the path of the "site file" by the correct number of dirname( dirname( ....dirname( __FILE__))) to retreive the root directory of the site.
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
Last Edit: 2012/03/07 18:43 By edwin2win.
The administrator has disabled public write access.
 
#9581
Re: Slave site table prefix 12 Years, 1 Month ago Karma: 0
Does Multi Sites use a Joomla table to store information?
mokelly1
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#9586
Re: Slave site table prefix 12 Years, 1 Month ago Karma: 54
NO.

JMS does not saves the website definition in the DB because it must be able to retreive the information before providing to Joomla the path of the "configuration.php" file.

In fact, to have a quick decision, when you save a slave site definition, this generate PHP code that JMS execute to immediately take the decision of which website is called.
This is done to avoid consuming CPU and take a decision very quickly.
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop
2Win, Multisite(s) are trademarks of Edwin2Win.
Joomla